From 27897f048f4cdb26d50a8697b35d5ee142a1563d Mon Sep 17 00:00:00 2001 From: Nils Briggen Date: Fri, 12 Jun 2026 08:27:02 +0200 Subject: [PATCH] Boot order: live scores first, slow sweeps after A restart during a live match sat behind the multi-minute odds sweep before the first scoreboard poll. The live loop now starts immediately after fixture mapping; odds/backfill/enrich follow on their own rate-limit keys. Co-Authored-By: Claude Fable 5 --- server/src/ingest/scheduler.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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