Skip to content

Commit d830851

Browse files
committed
Apply old PR 189
Closes chrisboulton/php-resque#189
1 parent b31bbdf commit d830851

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/Resque/Worker.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,14 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)
257257
$this->logger->log(Psr\Log\LogLevel::INFO, $status);
258258

259259
// Wait until the child process finishes before continuing
260-
pcntl_wait($status);
260+
while (pcntl_wait($status, WNOHANG) === 0) {
261+
if(function_exists('pcntl_signal_dispatch')) {
262+
pcntl_signal_dispatch();
263+
}
264+
265+
// Pause for a half a second to conserve system resources
266+
usleep(500000);
267+
}
261268

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

0 commit comments

Comments
 (0)