diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index 63f30ab7a271..b4d235b77cb7 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -103,10 +103,6 @@ public function daemon($connectionName, $queue, WorkerOptions $options) $this->registerTimeoutHandler($job, $options); - if ($this->shouldQuit) { - $this->kill(); - } - // If the daemon should run (not in maintenance mode, etc.), then we can run // fire off this job for processing. Otherwise, we will need to sleep the // worker so no more jobs are processed until they should be processed. @@ -191,6 +187,10 @@ protected function pauseWorker(WorkerOptions $options, $lastRestart) */ protected function stopIfNecessary(WorkerOptions $options, $lastRestart) { + if ($this->shouldQuit) { + $this->kill(); + } + if ($this->memoryExceeded($options->memory)) { $this->stop(12); } elseif ($this->queueShouldRestart($lastRestart)) {