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 <noreply@anthropic.com>
This commit is contained in:
@@ -201,15 +201,16 @@ export function startScheduler(
|
|||||||
enrichTimer = setTimeout(async () => { await enrichTick().catch(() => {}); scheduleEnrich(); }, ENRICH_MS);
|
enrichTimer = setTimeout(async () => { await enrichTick().catch(() => {}); scheduleEnrich(); }, ENRICH_MS);
|
||||||
};
|
};
|
||||||
|
|
||||||
// boot: map ids, then run the loops (odds first after mapping — line history
|
// boot: map ids, then LIVE FIRST — the odds sweep can take minutes and a
|
||||||
// is unrecoverable, so capture as early as possible)
|
// 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 () => {
|
void (async () => {
|
||||||
await mapAllFixtures().catch(() => {});
|
await mapAllFixtures().catch(() => {});
|
||||||
await oddsTick().catch(() => {});
|
|
||||||
await liveTick().catch(() => {});
|
await liveTick().catch(() => {});
|
||||||
|
scheduleLive(); // live cadence starts now; slow one-time sweeps follow
|
||||||
|
await oddsTick().catch(() => {});
|
||||||
await backfillExt().catch(() => {});
|
await backfillExt().catch(() => {});
|
||||||
await enrichTick().catch(() => {});
|
await enrichTick().catch(() => {});
|
||||||
scheduleLive();
|
|
||||||
scheduleEnrich();
|
scheduleEnrich();
|
||||||
scheduleOdds();
|
scheduleOdds();
|
||||||
backupDb(); // boot snapshot — the daily timer covers the rest
|
backupDb(); // boot snapshot — the daily timer covers the rest
|
||||||
|
|||||||
Reference in New Issue
Block a user