← All writing

Restart long-running queue workers after deploying code

Laravel 13 / PHP 8.3+Sources checked 2026-09-14

The website shows a fix, but queued jobs still execute the old behavior. A long-running queue worker keeps the booted application in memory. Replacing files on disk does not automatically restart that process.

Include workers in the release procedure

php artisan queue:restart

The restart signal uses the application's cache configuration. Workers finish their current job and exit when they observe the signal. A process manager must bring them back. Verify that both the deployment command and worker use the expected application and cache context.

Shared hosting changes the operating model

Some hosting plans do not support a persistent supervisor process. A bounded queue:work --stop-when-empty invocation from cron may fit the account, provided overlapping invocations and resource limits are handled. Confirm your host permits the workload before relying on it.

Use the same PHP runtime and extension configuration for web, cron, and worker commands. A job can fail only in the background if the cron PHP lacks an extension available to web PHP.

After deployment, enqueue a harmless diagnostic operation through the normal application path and verify the worker completes it with the new code. Do not infer worker health from a successful homepage request. Monitor failed jobs and stale pending work, and document who restarts or investigates the process when it exits unexpectedly. A restart command without a mechanism to run another worker can leave the queue idle.

Reference

Official documentation.