Laravel Queues in Production: The Gotchas Nobody Warns You About

·1 min read·

Laravel Queues are excellent. These are the production behaviours that will catch you off guard if you deploy them naively.

Laravel's queue system is genuinely excellent: expressive job classes, automatic retry with configurable backoff, failed job tracking, and multiple driver options (Redis, SQS, database).

The gotcha that catches most teams: the queue worker does not automatically reload configuration or code after deployment. If you deploy a code change and the worker is still running the old code, jobs will execute with the old version until the worker is restarted.

The fix: supervisor with a deployment hook that sends a SIGTERM to queue workers after each deployment. Laravel's queue workers handle SIGTERM gracefully — they finish the current job and then exit, letting supervisor restart them with the new code.

The second gotcha: failed jobs silently disappear if you have not configured the failed_jobs table. Run php artisan queue:failed-table and migrate it on day one, before you have any failures to track.

The third: long-running jobs can block your entire queue if you have only one worker. Always run multiple workers and set a sensible timeout on jobs that should not run for more than a few seconds.

— Dick Bassey | DevDick | 2022

Share this article
← Back to all writing