From 8403b34a6de212e5cd98d40333fd84d112fbb9f7 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 31 Jan 2017 12:57:23 -0600 Subject: [PATCH] move shouldKill check --- src/Illuminate/Queue/Worker.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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)) {