Queue Retries and Failed Jobs: Making Background Work Reliable
Configure retries, timeouts, and failed job handling so queued tasks do not silently break.
Queues are powerful, but only if failures are handled properly. Common failure reasons: - network errors (email provider, payment gateway) - timeouts - temporary DB outages ## Configure retries on a job ```php public $tries = 3; public $backoff = [10, 30, 60]; public $timeout = 60; ``` ## Failed jobs table ```bash php artisan queue:failed-table php artisan migrate ``` ## Retry a failed job ```bash php artisan queue:retry all ``` ## Flow ```mermaid flowchart LR A[Job Dispatched] --> B[Worker] B --> C{Success?} C -->|Yes| D[Done] C -->|No| E[Retry] E --> C C -->|Still fails| F[Failed Jobs Table] ``` In the next tutorial, we will design caching invalidation strategies.