Separating Job, Run, and Worker Claim Identities in a Requeue Design
A follow-up tutorial revisits a job queue example whose completion table treated job_id as a primary key, which blocked requeueing. Reproducing the issue showed that manually reopening a completed job let a worker claim it, but the second completion insert collided and rolled back. The author proposes modeling three distinct identities: the job, a run requested for that job, and the worker claim within a run. Retrying an existing run is treated as different from requesting a new run, even when the inputs look similar. The code therefore persists a new run ID, records its parent run, and only advances the job's current run if the expected predecessor is completed.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.




Discussion (0)
Log in to join the discussion and vote.
Log in