Repository navigation
fix(maintenance): tick every second and release the claim on SIGTERM - #14734
Conversation
The scheduler ticked every minute, so its lag gauge read a minute at rest and every slot went out a minute late. A rollout killed the process mid-sleep with the claim still held, so publishing paused until the lease ran out.
|
Review complete. No blocking issues — approved ✅; 1 nitpick below. 🧹 Nitpicks (1) — 🟢 1 low
The change reworks how maintenance work is scheduled: a new
Reviewed commit: 6fe4d4c |
🔵 Tier A · Mergeable after minor fixes
Maintenance scheduling now ticks every second while retaining five-minute slot publication and a 60-second crash-recovery lease. A stop-aware loop handles retries and shutdown, and the standalone maintenance task installs SIGTERM/SIGINT handlers so an orderly stop can finish the current tick and release its claim. The latest commit removes the simulated scheduler/telemetry test while retaining period-parsing coverage. Latest changes: The newest commit removes the long-running CycleTest scheduler/telemetry regression test and its associated imports.
Fix with agent prompt### Issue 1
tests/unit/Maintenance/CycleTest.php:33
**Keep regression coverage for the one-second scheduler tick**
Removing this test leaves no test that checks `Cycle`'s one-second scheduler tick or its resulting lag and dispatch-delay metrics; the package-level signal test uses a separate 60-second configuration, and `DispatcherTest` only checks published payloads. A regression to minute ticks would therefore pass the tests despite breaking the lag behavior this change introduces.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.📂 Walkthrough · 7
Reviewed the commits since |
Security rulesNo new WARNING or ERROR findings from security rules. 19 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
…uler-tick fix(maintenance): tick every second and release the claim on SIGTERM (cherry picked from commit a694ff2)
What
The inactive-project maintenance scheduler ticks every second and releases its claim on SIGTERM/SIGINT.
schedule.lagisnow - window start, so at a 60s tick it read ~60s at rest (and reported once a minute). Slots still go out once per 300s from theIntervaltrigger, same slot numbers.run()'sfinallyreleases the claim, and a standby takes over on its next tick.scheduleprocess, which keeps default SIGTERM handling).The restart loop's state (current scheduler, stopped flag, a back-off a stop interrupts) moves into
Appwrite\Maintenance\Loop.Verified
Two
schedule-maintenanceprocesses against Redis: SIGTERM to the leader exits in ~50ms, the standby publishes the next slot on time, and a final SIGTERM leavestoken="",expiresAt=0with coverage kept.Related: appwrite-labs/cloud#6628