Scheduler tick has race condition — multi-node deploy will double-fire recorder starts #103
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Fixed in
04ce096.scheduler.jsnow wraps each tick inpg_try_advisory_lock(8210301)so exactly one replica processes a given interval. Pending → starting and running → stopping transitions are atomic viaUPDATE … FOR UPDATE SKIP LOCKED, so even without the lock a row can only be claimed once.zgaetano referenced this issue2026-05-26 18:22:49 -04:00
Fix Plan — #103 Scheduler race condition (multi-node double-fire)
Root cause:
scheduler.js:31-130polls every 15s. Two mam-api instances both SELECT samependingrow, both call/start, second races on container create.Fix — use
SELECT ... FOR UPDATE SKIP LOCKED:This ensures only one instance claims each pending row.
Files:
src/scheduler.js:31-130Effort: ~1h
**Priority: P1 — only triggers in multi-node deploy