Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Let worker ungracefully exit on memoryExceeded #17296

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 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(12);
}

if ($this->queueShouldRestart($lastRestart)) {
$this->stop();
}
}
Expand Down Expand Up @@ -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);
}

/**
Expand Down