Task Queue with Retries is an in-memory job queue that handles background tasks like sending welcome emails and generating documents. Workers claim jobs, process them, and report the result using an ack for success or a nack for failure. All time-based decisions use an injected clock, so tests advance time by hand and nothing sleeps.
The round has five phases:
The biggest challenge in this problem is handling time correctly. The queue doesn't use timers, so nothing happens automatically. For example, a lease that expired at t = 50 remains "in flight" in memory until some call checks the clock.
Even if the queue notices much later, it must behave as though every expiry and every retry happened at its exact moment.
That's where most of the hidden tests and most of the traps come from: each one comes down to getting one boundary or one timestamp exactly right.