Build a Message Queue (RabbitMQ / SQS) (14 scenes)
Scene 09 · Visibility timeout — the silent-worker clock
Per-message countdown; if no ack arrives, the broker redelivers. Too short → duplicates; too long → stuck pool; heartbeat extend is the fix.
Previously
Delivery count climbs when consumers nack — but silent workers never nack. The broker needs a second clock that catches workers that don't say anything, succeed or fail.
Scene 09
Visibility timeout — the broker's silent-worker clock
Diagram
A queue strip with the head on the left and the tail on the right. When a worker takes a cell it goes 'in flight' — drawn dashed and grey — and a circular countdown badge appears on it (the visibility timeout, in seconds remaining). Above each worker, a horizontal processing bar shows how long it has been chewing on its cell. If the bar finishes first, the worker sends 'ack' and the cell vanishes. If the countdown hits zero first, the broker assumes the worker is dead, redelivers the cell to a peer, and the red duplicate-side-effects counter ticks up.
Worker 1 grabs the head cell — its 30-second countdown starts. The processing bar finishes in 10 seconds, ack fires, the cell vanishes. Then watch what happens when a worker is slower than the timeout: the countdown hits zero, the broker hands the same cell to a peer, both eventually ack, and the red duplicate counter ticks up.