Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
Assume at-least-once delivery: make tasks idempotent with unique keys and state checks, pass ids instead of full objects, enqueue only after the database transaction commits, use bounded retries with backoff, and monitor queues and dead-letter failures.
Workers can crash after doing work but before acknowledging, and acks_late or visibility timeouts can redeliver tasks, so a task like charging a card must check an idempotency key or the current state before acting. Tasks should receive identifiers and load fresh data, since serialized objects may be stale. Enqueuing inside a transaction can run the task before the data exists or for data that was rolled back, so use transaction.on_commit or an outbox table. Retries should apply only to transient errors, with exponential backoff, jitter and a maximum, after which failures are recorded for investigation. Set time limits so stuck tasks do not block workers, separate queues for slow and fast tasks, and monitor queue length, task latency and failure rates.