diff --git a/server/src/ingest/scheduler.ts b/server/src/ingest/scheduler.ts index 0a12df3..974bd1e 100644 --- a/server/src/ingest/scheduler.ts +++ b/server/src/ingest/scheduler.ts @@ -201,15 +201,16 @@ export function startScheduler( enrichTimer = setTimeout(async () => { await enrichTick().catch(() => {}); scheduleEnrich(); }, ENRICH_MS); }; - // boot: map ids, then run the loops (odds first after mapping — line history - // is unrecoverable, so capture as early as possible) + // boot: map ids, then LIVE FIRST — the odds sweep can take minutes and a + // restart mid-match must not blank the live scores meanwhile. Odds use their + // own rate-limit key ('espn-odds'), so the sweeps interleave politely. void (async () => { await mapAllFixtures().catch(() => {}); - await oddsTick().catch(() => {}); await liveTick().catch(() => {}); + scheduleLive(); // live cadence starts now; slow one-time sweeps follow + await oddsTick().catch(() => {}); await backfillExt().catch(() => {}); await enrichTick().catch(() => {}); - scheduleLive(); scheduleEnrich(); scheduleOdds(); backupDb(); // boot snapshot — the daily timer covers the rest