fix: reliability - scheduler retry with backoff, graceful shutdown, validate env vars #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/reliability"
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?
Summary
process.exit(0)withserver.stop(true)+process.exitCode = 0to allow pending I/O (including SQLite writes) to complete before exit. Guard against concurrent signal handling.REFRESHenv var is now clamped to a minimum of 1 with fallback to 1440 minutes.REFRESH=0,REFRESH=abc,REFRESH=-1no longer cause unpredictable behavior.startScheduler()no longer callsinitDB()sinceserver.tsalready calls it beforestartScheduler().StationWithPricetype import removed from scheduler.Files changed
src/lib/scheduler.ts— Retry logic, env validation, remove redundant initDBsrc/server.ts— Graceful shutdown withserver.stop()instead ofprocess.exit()src/lib/api.ts— Fix filterByPostalCodePrefixTest plan
bun test— all 30 tests passREFRESH=0and verify scheduler uses 1-minute minimum