Skip to content

Commit

Permalink
Let worker ungracefully exit on memoryExceeded
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeofguenter committed Jan 12, 2017
1 parent e480e17 commit 16a0d7d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Illuminate/Queue/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 16a0d7d

Please sign in to comment.