Deep search: pass the database client, not the db module, so start/jobs/estimate stop returning 500
This commit is contained in:
@@ -44,6 +44,8 @@ function publicJob(row, indexSize = 0) {
|
|||||||
export function createDeepSearchService({ db = defaultDb, searchDeep = innertube.searchDeep, related = innertube.related,
|
export function createDeepSearchService({ db = defaultDb, searchDeep = innertube.searchDeep, related = innertube.related,
|
||||||
browseUploads = innertube.browseUploads, ingest = catalog.ingest, putSearch = searchCache.put,
|
browseUploads = innertube.browseUploads, ingest = catalog.ingest, putSearch = searchCache.put,
|
||||||
sleep = sleepDefault, random = Math.random, now = Date.now, autoStart = true } = {}) {
|
sleep = sleepDefault, random = Math.random, now = Date.now, autoStart = true } = {}) {
|
||||||
|
// Accept the db.js module namespace as well as the client itself.
|
||||||
|
if (typeof db?.execute !== 'function' && typeof db?.db?.execute === 'function') db = db.db;
|
||||||
let worker = null;
|
let worker = null;
|
||||||
let timer = null;
|
let timer = null;
|
||||||
const log = (state, message) => { state.log ||= []; state.log.push({ at: now(), message: String(message).slice(0, 240) }); if (state.log.length > 100) state.log.splice(0, state.log.length - 100); };
|
const log = (state, message) => { state.log ||= []; state.log.push({ at: now(), message: String(message).slice(0, 240) }); if (state.log.length > 100) state.log.splice(0, state.log.length - 100); };
|
||||||
|
|||||||
@@ -2360,7 +2360,7 @@ const notes = registerNoteRoutes(app, {
|
|||||||
{ label: 'Database', path: dirname(process.env.DB_PATH || './data/ytplayer.db') },
|
{ label: 'Database', path: dirname(process.env.DB_PATH || './data/ytplayer.db') },
|
||||||
] },
|
] },
|
||||||
});
|
});
|
||||||
const deepSearch = registerDeepSearchRoutes(app, { db: notesDb, adminAuth: notes.requireAdminOrToken, autoStart: false,
|
const deepSearch = registerDeepSearchRoutes(app, { db: notesDb.db, adminAuth: notes.requireAdminOrToken, autoStart: false,
|
||||||
searchDeep: innertube.searchDeep, related: innertube.related, browseUploads: innertube.browseUploads,
|
searchDeep: innertube.searchDeep, related: innertube.related, browseUploads: innertube.browseUploads,
|
||||||
ingest: collectVideoMetadata, putSearch: searchCacheDb.put });
|
ingest: collectVideoMetadata, putSearch: searchCacheDb.put });
|
||||||
registerAdminToolsRoutes(app, { db: notesDb, adminAuth: notes.requireAdminOrToken, media,
|
registerAdminToolsRoutes(app, { db: notesDb, adminAuth: notes.requireAdminOrToken, media,
|
||||||
|
|||||||
Reference in New Issue
Block a user