Repository navigation
Refuse to retry a job a worker is still running - #42
Merged
Merged
Conversation
- Add requeue helper that only clears lease when job is not processing, has no lease, or lease is expired - Update retry_job route to use requeue and return 409 when live lease exists - Add tests for live lease refusal, failed job requeue, expired lease requeue, and missing job handling - Prevents double-processing of evidence when retry is called during active job Fixes race condition where retry could queue same job for multiple workers simultaneously, violating lease protection.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
POST /jobs/{id}/retryreset any job topendingand cleared its lease, even one a worker held a live lease on, so a second worker could claim and process the same evidence while the first was still running (L-04 family).requeue(db, job_id)updates in one statement, only when the job is notprocessing, has no lease, or the lease has expired; the route answers 409 otherwise.WHEREmakestest_retry_refuses_a_job_with_a_live_leasefail.pytest tests/test_processing_worker.py+ retry tests: 12 passed; ruff clean.Written by GLM (worker-mcp), reviewed by Claude.
🤖 Generated with Claude Code