diff --git a/app/services/spot_inspector.ts b/app/services/spot_inspector.ts index 5c607c8..c72569c 100644 --- a/app/services/spot_inspector.ts +++ b/app/services/spot_inspector.ts @@ -16,6 +16,8 @@ const BATCH = 20 const IDLE_MS = 60_000 /** Unmatched spots are matched again this often (the header pass may have built their releases since). */ const REMATCH_MS = 60 * 60 * 1000 +/** Unmatched spots matched again per hour: after a reset every spot is (16.5k at 500 an hour took 33 h). */ +const REMATCH_BATCH = 5000 /** Unmatched spots are matched again for this long after their inspection. */ const REMATCH_DAYS = 30 /** A file's release posted further apart than this from the NZB's date is another upload of the same name. */ @@ -295,8 +297,8 @@ export class SpotInspector { const { rows: spots } = await db.rawQuery( `SELECT message_id, inspected_at, release_id FROM spots WHERE status = 'inspected' AND matched = 0 AND inspected_at > now() - make_interval(days => ?) - ORDER BY coalesce(rematched_at, inspected_at) LIMIT 500`, - [REMATCH_DAYS] + ORDER BY coalesce(rematched_at, inspected_at) LIMIT ?`, + [REMATCH_DAYS, REMATCH_BATCH] ) const cutoff = Date.now() - coordinatorConfig.spots.standaloneAfterHours * 3600 * 1000 for (const spot of spots) {