From 16a0d7d6081e48d4ca8f5679afcd1565f7f1a706 Mon Sep 17 00:00:00 2001 From: Gunter Grodotzki Date: Thu, 12 Jan 2017 14:23:57 +0200 Subject: [PATCH] Let worker ungracefully exit on memoryExceeded --- src/Illuminate/Queue/Worker.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index a8bd580266f9..ef2589b59221 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -77,8 +77,11 @@ public function daemon($connectionName, $queue, WorkerOptions $options) $this->sleep($options->sleep); } - if ($this->memoryExceeded($options->memory) || - $this->queueShouldRestart($lastRestart)) { + if ($this->memoryExceeded($options->memory)) { + $this->stop(1); + } + + if ($this->queueShouldRestart($lastRestart)) { $this->stop(); } } @@ -389,11 +392,11 @@ public function memoryExceeded($memoryLimit) * * @return void */ - public function stop() + public function stop($status = 0) { $this->events->fire(new Events\WorkerStopping); - die; + exit($status); } /**