From 9ba89c7dc07314854bd81216562522f51ad62944 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 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index a8bd580266f9..50b994c0888d 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(12); + } + + if ($this->queueShouldRestart($lastRestart)) { $this->stop(); } } @@ -387,13 +390,14 @@ public function memoryExceeded($memoryLimit) /** * Stop listening and bail out of the script. * + * @param int $status * @return void */ - public function stop() + public function stop($status = 0) { $this->events->fire(new Events\WorkerStopping); - die; + exit($status); } /**