Skip to content

Commit

Permalink
Apply old PR 189
Browse files Browse the repository at this point in the history
  • Loading branch information
danhunsaker committed Dec 11, 2018
1 parent b31bbdf commit d830851
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Resque/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,14 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)
$this->logger->log(Psr\Log\LogLevel::INFO, $status);

// Wait until the child process finishes before continuing
pcntl_wait($status);
while (pcntl_wait($status, WNOHANG) === 0) {
if(function_exists('pcntl_signal_dispatch')) {
pcntl_signal_dispatch();
}

// Pause for a half a second to conserve system resources
usleep(500000);
}

if (pcntl_wifexited($status) !== true) {
$job->fail(new Resque_Job_DirtyExitException('Job exited abnormally'));
Expand Down

0 comments on commit d830851

Please sign in to comment.