mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Jobs: _claim_job docstring states the invariant, not the old race
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
9f8da18cd0
commit
09111b9bc5
1 changed files with 1 additions and 4 deletions
|
|
@ -200,10 +200,7 @@ def cancel_job(job_id: str) -> dict:
|
|||
|
||||
def _claim_job(job_id: str) -> Optional[dict]:
|
||||
"""Move a Job from PENDING to RUNNING in one step under the lock; returns the running record,
|
||||
or None when the Job is no longer pending (cancelled while queued, or already claimed).
|
||||
|
||||
Reading the status and writing RUNNING separately let a cancel land in between and be
|
||||
overwritten, running a Job the user had cancelled."""
|
||||
or None when the Job is no longer pending (cancelled while queued, or already claimed)."""
|
||||
with _lock():
|
||||
record = _jobs().get(job_id)
|
||||
if not record or record['status'] != PENDING:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue