Repository navigation
Release claims whose dequeue caller was cancelled - #7
Open
janbjorge wants to merge 2 commits into
Conversation
If a dequeue caller was cancelled (e.g. by a timeout) after its claim reached storage, the jobs were committed IN_PROGRESS but the result was thrown away. Nobody worked them or heartbeated them, so they sat idle until the stale timeout (5 minutes by default). In GroupCommitLoop an op cancelled while still pending was also applied anyway. - StateQueries.release_claims(jobs): return jobs to QUEUED only if they are still exactly as the abandoned claim left them (IN_PROGRESS, same heartbeat), so a job heartbeated, acked or re-claimed since is left alone. Pure, never raises. - GroupCommitLoop: drop ops whose future is already done before applying them; when a dequeue is cancelled while its write is in flight, queue release_claims for its result in the next batch. - DirectQueue.dequeue: run the claim shielded; on cancellation let it finish in a tracked background task and release its jobs.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack 5/9, base #6.
A dequeue cancelled after its claim committed left the jobs IN_PROGRESS with no worker until the stale timeout. Now ops cancelled before apply are dropped, and orphaned claims are released afterwards (only if untouched since).
Tests:
test_dequeue_cancelled_during_write_releases_claim(both services),test_op_cancelled_before_apply_is_droppedfail on base;test_uncancelled_dequeue_keeps_claim,test_cancelled_dequeue_does_not_release_job_heartbeated_sincepass on both.