Problem
A queue demo is easy until workers die mid-task, duplicate ownership appears, retries overwhelm the system, or expired leases never return work to pending.
What I built
I built a Redis-backed queue with at-least-once delivery, atomic claim/extend/reclaim scripts, priority queues, delayed scheduling, exponential backoff, DLQ behavior, and Prometheus instrumentation.
Architecture / system design
The core follows the Reliable Queue Pattern: pending queues, processing leases, Lua-backed atomic transitions, reaper sweeps, delayed retries, and worker APIs around those state transitions.
Failure modes / what broke
The key bug was lease extension racing with reclaim: without a single atomic check-and-extend operation, two consumers could believe they owned the same task.
Proof / metrics / tests
With a 30-second lease and 5-second reaper sweep, the documented reclaim bound is about 35 seconds. The page also includes a live browser simulation of worker death, requeue, retry, and DLQ flow.
Lessons learned
The important part of queue design is not pushing jobs into Redis; it is naming every state transition and making ownership changes atomic.