Repository navigation
12.33.1
Schema version: 42 — unchanged from 12.33.0, so no migration runs on upgrade.
Three fixes to the timers behind pg-boss's background passes, the first of which was skipping an interval of work on a healthy deployment.
Interval passes keep their cadence
Each background pass — cron, queue monitoring, maintenance, flow resolution, BAM, index rebuilds — is claimed by one instance per interval. That claim was being refused whenever a tick's statement reached the server a few milliseconds faster than the previous tick's had, and the next pass then came a whole interval late. On an idle Linux box at a 45-second cron interval, 4 of every 19 ticks.
What it cost:
- Scheduled jobs, on deployments that increased
cronMonitorIntervalSecondsabove the default of 30 seconds. Each scheduling pass sends the occurrences of the preceding 60 seconds, so at the default of 30 seconds a skipped pass leaves a gap the window still covers and nothing is lost. Set above 30, two intervals outgrow that window, and occurrences falling in the gap were missed. - Queue monitoring.
superviseIntervalSecondsandmonitorIntervalSecondsboth default to 60, which gave that claim the same shape and lost about a quarter of its passes: gaps inqueue_stats, and job expiry, heartbeat failure and deletion each deferred an interval.
Each timer now schedules its next attempt from the moment its claim stamped the row rather than on a fixed grid, so the gap between two passes can only come out long, never short. Nothing runs early — the claim still refuses anything short of the full interval.
Thanks to @toruiwasa for #905, which found and diagnosed this.
TestClock runs a pass on every tick
A real clock never lands on exactly the interval; a fake one lands there every time, and the claim refused it. A test that ticked one cronMonitorIntervalSeconds got no cron pass, and a pass ran on every other tick.
A tick now produces a pass. A suite written against 12.33.0 that ticks twice to get one pass now gets two, so counts and timings asserted around that shift by an interval — tick once per expected pass.
Full Changelog: 12.33.0...12.33.1