Skip to content

Commit

Permalink
Merge pull request #29366 from djtarazona/patch-1
Browse files Browse the repository at this point in the history
Fix worker timeout handler when there is no job processing
  • Loading branch information
taylorotwell authored Aug 1, 2019
2 parents 6663bd8 + 2f80319 commit c7eaba6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Illuminate/Queue/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ protected function registerTimeoutHandler($job, WorkerOptions $options)
// process if it is running too long because it has frozen. This uses the async
// signals supported in recent versions of PHP to accomplish it conveniently.
pcntl_signal(SIGALRM, function () use ($job, $options) {
$this->markJobAsFailedIfWillExceedMaxAttempts(
$job->getConnectionName(), $job, (int) $options->maxTries, $this->maxAttemptsExceededException($job)
);
if ($job) {
$this->markJobAsFailedIfWillExceedMaxAttempts(
$job->getConnectionName(), $job, (int) $options->maxTries, $this->maxAttemptsExceededException($job)
);
}

$this->kill(1);
});
Expand Down

0 comments on commit c7eaba6

Please sign in to comment.