Idempotent Job Handlers
Talk it through out loud with your AI coach.
The problem
- medium
- Pro
Your queue promises at-least-once delivery, and a few customers were charged twice when a worker crashed after charging but before marking the job done. Explain why this happens and how to make job handlers safe to run twice.
What a strong answer covers
- Why a queue may hand the same job to a worker more than once.
- What it means for a handler to be safe to run again.
- Practical ways to detect and skip work that has already been done.
- Using the database or the payment provider to enforce it.
Common mistake: Expecting the queue to guarantee that each job runs exactly once.
Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.
Practise it out loud