backup-scheduler: dont replay missed daily slots on startup #42
Reference in New Issue
Block a user
Delete Branch "fix/backup-scheduler-no-replay"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes a bug where the wrapper, on service restart, would fire one catch-up backup per minute for each daily-times slot that had already passed today. With a schedule like
00:00,04:00,08:00,12:00,16:00,20:00and a restart at 19:00, this meant 5 near-identical full-world zips at 1-minute intervals.Source comment already documented the intended behaviour but the code didnt implement it. Fixed in
Start()by pre-populating_firedTodaywith all times <= now.Tested live on glados. New binary deployed. Switched schedule to clock-aligned
00:00,04:00,08:00,12:00,16:00,20:00after deploy: zero catch-up backups fired in the 90s window after restart (vs 5+ before the fix).The wake loop's daily-times branch was firing one missed slot per minute on service restart. With a schedule like "00:00,04:00,08:00,12:00,16:00, 20:00" and a restart at 19:00, the wrapper would catch up by firing 5 backups at 1-minute intervals -- each a full-world zip of the same in-memory world. Pure waste: the live world hasn't diverged across the missed clock slots, the snapshots would be near-identical, and the rapid save-off/save-on churn impacts player experience. Source comment already documented the intended behaviour ("Doesn't catch up if the server was off when a slot passed -- daily/interval backups don't need replay logic.") but the code didn't implement it. Fix: in Start(), pre-populate _firedToday with all times <= now so the wake loop only fires future slots for the rest of today. Tested live on glados: switched schedule to clock-aligned daily-times after deploying the fix, zero catch-up backups fired in the 90s window after restart (vs 5+ before the fix). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>