You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(run-engine,webapp): return unclaimed runs to the queue when pausing
Pausing a queue or environment set its concurrency limit to 0, which stops the
queue admitting new runs but does nothing about runs it had already admitted.
Those runs sit in a per-region worker queue that supervisors drain with a plain
BLPOP, with no pause or concurrency check on the pop path, so they went on to
execute during the pause. An idle environment with headroom can have its whole
concurrency limit's worth of runs in that state, since the trigger-time fast
path pushes straight to the worker queue.
Adds RunQueue.returnUnclaimedMessagesToQueue, which moves runs the queue has
admitted but no worker has claimed yet back into the pending queue. Candidates
come from the difference between currentConcurrency and currentDequeued, which
identifies worker queue residents without scanning the region-wide list. Each
move runs in a Lua script whose LREM doubles as the claim: if it removes
nothing then a worker already owns that run and every other key is left alone,
so a concurrent BLPOP can never produce a duplicate dispatch.
Ordering is preserved by re-adding at the message's original timestamp rather
than a fresh score the way nack does, so a returned run keeps its place in
line. Callers must set the concurrency limit to 0 first: returning a run costs
it its position in the worker queue FIFO and it can only re-enter at the back,
so a queue that can still admit work could let a newer run overtake one on its
way back. All three pause callers already do this ordering.
Covers the manual queue pause, the manual environment pause, and the
billing-limit environment pause.
Pausing a queue or an environment now also holds back runs that were already waiting to start. Previously those runs would still go ahead, so a pause could take effect a little later than expected.
0 commit comments