In Flight But Not Lost
When a worker receives a job it does not delete it yet. The broker hides the job for a visibility timeout window. During that window other workers cannot see it. The worker must finish and acknowledge before the window expires.
The Two Outcomes
- Worker finishes in time and acknowledges, so the broker deletes the job.
- Window expires first so the broker assumes the worker died and makes the job visible again for another worker.
This is how a crashed worker does not strand a job, while a live worker keeps exclusivity.
Choosing the Window
- Too short and a slow but healthy worker loses its job mid run, causing duplicate processing.
- Too long and a truly dead worker holds the job idle, delaying recovery.
Set the window above the realistic worst case duration for that job type.
Heartbeat Extension
For long or variable jobs, a worker can extend the timeout periodically while it makes progress. This avoids setting one huge static window and lets stuck jobs still time out.
Key idea
The visibility timeout hides an in flight job so only one worker holds it, and redelivers if the worker fails to finish in time.