fix(cron): derive async job retention cutoffs from one clock read
Merged
TH
2mo ago+3+3+0123456789-2-2-0123456789
Summary
- The stale-execution cleanup cron computed the async-job retention cutoff and the irrecoverable schedule-carrier cutoff from two separate
Date.now()calls, so a millisecond tick between the statements skewed the gap between the two windows by 1 ms. - Snapshot the clock once and derive both cutoffs from it, which also un-flakes
cleanup-stale-executions/route.test.ts(it asserts the gap equals the constant difference).
Type of Change
- Bug fix
Testing
Tested manually — vitest run app/api/cron/cleanup-stale-executions/route.test.ts (15/15), bun run lint, block-registry check, and bun run check:audits (39 audits) all pass.
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing
- No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)