Laravel Queue Workers During Deployment
Laravel queue workers are long-lived processes, so deploying files does not automatically load new code. Plan backward-compatible jobs and schema changes, signal a graceful restart, and verify that a process manager brings workers back and the queue progresses.
Deploying Laravel changes the files on disk, but a queue worker that already booted can continue running the previous application in memory. A successful web request therefore does not establish that background work uses the new release. Treat the worker fleet, the queue backend and any jobs already reserved as part of the deployment, not as an afterthought.

Map the lifecycle before changing it
Gracefully restart Laravel queue workers after deploying; changing files alone does not reload their code. Align worker timeout with job retry timing to reduce duplicate processing risk.
The Laravel queue documentation describes workers as long-lived processes. A worker boots the application, takes a job, finishes or fails it, and then asks for more work. If a deployment replaces the code while a job is executing, the running process may still hold its old classes and configuration. A new web process and an old worker can coexist, and a queued payload can outlive either release.
Inventory each application environment, queue connection, queue name, worker command, process-manager configuration and host. Include dedicated priority queues and any separate servers. Identify who owns the deployment, the longest legitimate job, external APIs touched by jobs, and the evidence that a job succeeded. Distinguish the queue connection, which identifies a backend, from queue names within that connection. An apparently healthy worker listening to the wrong queue does not protect the intended workload.
Also list who creates jobs. Web requests, scheduled tasks and other workers may all be producers. If a breaking change requires a drain, pausing just the web application may not prevent more old-format jobs entering the queue. Agree on the scope and how producers will resume before pausing anything in production.
| Change boundary | Question to answer | Evidence |
|---|---|---|
| Application release | Can old and new workers read the same data? | Compatibility test and migration plan |
| Job payload | Can the new handler deserialize queued older jobs? | Representative pending payload test |
| Worker lifecycle | Will the manager replace a gracefully exiting process? | Manager status and new process start |
| Business operation | Can a retry repeat an external side effect safely? | Idempotency and reconciliation design |
Queue backend choice is an operational decision, not a vote. The snapshot below describes public repository attention, not installations, latency, reliability or suitability. Laravel documents built-in Redis and Beanstalkd drivers; Valkey compatibility must be verified for your particular client and configuration, while RabbitMQ requires a compatible third-party integration rather than an included Laravel driver.
Queue-related projects: GitHub stars
Public repository snapshot; not a quality or usage measure
- redis/redis77,753
- valkey-io/valkey27,918
- rabbitmq/rabbitmq-server13,987
- beanstalkd/beanstalkd6,701
View chart data
| Item | stars | Note |
|---|---|---|
| redis/redis | 77,753 | |
| valkey-io/valkey | 27,918 | |
| rabbitmq/rabbitmq-server | 13,987 | |
| beanstalkd/beanstalkd | 6,701 |
For the underlying snapshots see the GitHub APIs for Redis, Valkey, RabbitMQ and Beanstalkd, viewed 29 November 2026. The stars belong to projects with different scopes and histories; they are not a comparative test of Laravel drivers.
Deploy compatible code and signal workers
First prepare the release, dependencies and configuration with the same runtime identity and paths that production uses. Perform additive database migrations only after checking your application's migration and rollback plan. Make sure both the currently running and newly started worker can use the intermediate schema. Switch the release using your established procedure, then issue php artisan queue:restart from the new application's directory as the appropriate application user. This changes runtime state: run it only for the intended environment, not as an exploratory command.
The restart signal is stored in Laravel's cache. Workers finish the current job before exiting and need a process manager to start replacements. All intended workers must see the same effective cache store and restart key as the command, including cache prefix and environment. A release with separate local cache files, or a changed prefix, may not signal the existing fleet. Check the actual configuration without printing credentials. A manager that does not restart exited workers can leave the queue unattended.
The Laravel deployment guide also discusses reloading long-running services. Choose the documented procedure for the components actually in use; avoid assuming that a generic web-server reload restarts queue workers. If using Horizon, follow its own lifecycle and configuration rather than substituting an unrelated worker command. Test the sequence in staging using the same directory layout, cache topology and worker identities as production.
After signalling, wait for the longest valid in-flight job to complete. Verify process start times or release identifiers from a controlled application health signal, and check the manager's status for every queue and host. Do not make the deployment indefinitely wait without an escalation path: investigate a worker that remains blocked or a job that exceeds its allowed runtime, then follow a documented incident procedure.
Align timeout and retry boundaries
A worker timeout, the queue reservation or visibility period, application-level network timeouts, and the manager's stop allowance solve different problems. Laravel advises making the worker timeout several seconds shorter than retry_after; otherwise a job can become available for another worker while the first is still running. Amazon SQS uses its visibility timeout rather than Laravel's retry_after. Configure and test the equivalent relationship for the actual backend.
Set the job or worker execution timeout high enough for legitimate work, but below the reservation period with a margin for termination and cleanup. Set timeouts on outgoing HTTP and socket operations too: a library stuck waiting on I/O may need its own deadline. Laravel notes that enforcing a worker timeout requires the PCNTL extension. For Redis, an indefinitely blocking queue read can delay signal handling until a job arrives; choose blocking settings with shutdown behavior in mind.
The Supervisor configuration reference documents its stop-wait behavior. Set stopwaitsecs longer than the longest job you intend to let finish during a managed stop, with operational margin. Do not blindly copy values: a manager may eventually force termination, and a job-specific timeout may end work earlier. Restart policies, child processes and your deployment platform's own termination grace period must agree.
Graceful shutdown reduces interruption; it does not provide exactly-once delivery. A worker can crash after an external service accepted a request but before the queue records completion. Use durable idempotency keys or equivalent business checks, make database writes transactional where appropriate, and reconcile external effects before retrying. Document the expected behavior for jobs that cannot safely be repeated automatically.
Handle breaking changes and rollback
Prefer an expand-and-contract sequence: add a compatible column or interface, deploy readers and writers that tolerate both representations, migrate existing data with a separately reviewed procedure, and remove the old representation only after old workers and old payloads are gone. Retain compatibility for queued jobs that may be delayed, retried or in a failed-job store. Test a worker with representative serialized jobs from the previous release instead of testing only fresh jobs.
If compatibility cannot be maintained, agree on a maintenance window. Stop or redirect all producers, let reserved work finish, inspect pending and failed work, and confirm that no old-format jobs remain before the breaking change. Draining is not the same as deleting. Never clear a production queue merely to make a deployment look healthy: queued items may represent money movement, messages or customer data. Use the application's approved recovery and reconciliation procedure for exceptions.
Rolling back code does not automatically reverse migrations or undo side effects. Before deploying, establish whether the old code can run against the new schema and whether new-format jobs can be consumed by the old release. If not, keep a forward-fix path and restore procedure. A database restore can discard legitimate writes since its recovery point; it needs a business decision, not an automatic reaction to a failing worker.
Verify consumption and prepare the next run
After the restart, check worker counts, restarts, queue depth and age of the oldest pending job. Check failed jobs through the configured failure store and investigate the underlying cause before retrying. Send a safe, non-destructive test job through each important connection and queue, then verify an application-level completion record. A running process and an empty error log alone do not prove that a job was actually consumed.
Watch for backlog growth, repeat attempts, missing credentials, serialization errors and external-service throttling. Compare the release identifier of workers with the intended release without exposing environment values. If a queue is quiet, use a purpose-built heartbeat job with no customer side effects rather than replaying production work as a test.
Record the deployment time, release, signalled environment, process-manager result, pending and failed-job observations, and any exception. Include a named owner and rollback decision point in the runbook. Rehearse the procedure with a job in flight and a delayed job in the queue, because a clean, idle staging queue can hide the very timing problem the procedure is meant to handle.
For scheduling producers, see Laravel scheduler operations; for deployment ownership, see deployment ownership. Sora Panel is not released yet. Read how it works on the homepage.
Frequently asked questions
Does deploying code restart Laravel queue workers?
No. Workers are long-lived; signal them to exit gracefully and ensure a process manager starts replacements.
Does queue:restart interrupt the active job?
Laravel workers normally finish the current job before exiting, subject to timeouts, process termination and failures. Align worker timeout with job retry timing to reduce duplicate processing risk.
Can a job run more than once?
Yes. A crash or reservation timeout can result in a retry, so design and reconcile side effects accordingly.
Does rolling back code undo a database migration?
No. Schema rollback and data recovery are separate, potentially destructive operations requiring their own plan.
Sources
- Laravel queues (viewed 2026-11-29)
- Laravel deployment (viewed 2026-11-29)
- Supervisor configuration (viewed 2026-11-29)
- GitHub API: Redis (viewed 2026-11-29)
- GitHub API: Valkey and RabbitMQ (viewed 2026-11-29)
- GitHub API: Beanstalkd (viewed 2026-11-29)
Sora Panel is not released yet. Read how it works on the homepage.