4. Drain Dead Letter Queues

Purpose: Retry failed messages sitting in dead letter queues so they get another chance at processing.

Prerequisites:

  • Bun installed with bun install completed
  • Workers running (messages will be reprocessed by active workers)
  • Upstash Redis credentials in .env.local
  • The root cause of the failures should be resolved before retrying

Cost / Duration: $0 (no AI cost for retry itself) | 5-15 minutes

Prompt

Drain the dead letter queues by retrying failed messages. Before retrying,
make sure the root cause of the failures has been resolved (e.g., bug fix
deployed, API outage resolved, rate limits cleared).

Step 1 -- Check current DLQ state to see which queues have failed messages:
```bash
bun scripts/diagnose-pipeline.ts
```

Step 2 -- Retry all DLQ messages (moves them from DLQ back to primary queues):
```bash
bun run scripts/queue-recovery.ts --action=retry-dlq
```

Step 3 -- Monitor reprocessing by running the diagnostic periodically:
```bash
bun scripts/diagnose-pipeline.ts
```

DLQ counts should decrease as workers reprocess messages. If messages
immediately return to the DLQ, the root cause is not yet fixed --
investigate the specific error before retrying again.

Verification

  • DLQ counts identified before retry
  • Retry command executed successfully
  • DLQ counts return to 0 after reprocessing
  • No new DLQ entries appear after retry
  • Messages are successfully processed by workers

Back to index