-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Description
Laravel Version
11.45.1
PHP Version
8.2.6
Database Driver & Version
No response
Description
When the queue:work worker is run with the --max-time option and enters a paused state (e.g., during maintenance mode), it exits prematurely.
The root cause is in the Illuminate\Queue\Worker class. The pauseWorker method calls the stopIfNecessary method but fails to pass the required $startTime argument.
As a result, $startTime receives its default value of 0 inside stopIfNecessary, causing the max-time check to pass immediately and the worker to terminate.
The fix is to correct the call in pauseWorker to properly propagate the $startTime argument to stopIfNecessary, ensuring the runtime is calculated correctly.
Steps To Reproduce
- Put the Laravel application into maintenance mode:
php artisan down - Run the queue worker with any --max-time limit:
php artisan queue:work --max-time=3600 - Observe the output. The worker process will exit after the first cycle (e.g., after the sleep duration) instead of continuing to run for the specified max time.
The expected behavior is for the worker to pause and continue its loop, respecting the --max-time limit, even while the application is in maintenance mode.