Designing background jobs that can be retried safely
A job system can recover from common outages when each task has a clear identity and records its progress.
Give every change a stable key
Use a consistent identifier for the operation, such as an order number and action type. Decide which changes must happen once and what result a retried job should return when work already completed.
Separate delayed work from broken work
Test a timeout, a bad payload, and duplicate delivery. Back off retries for temporary failures and give operators enough context to resolve failed jobs without logging private data.