From 650f74cf5e5c0e3b1d85ce3315eb0496bc2560a1 Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Sat, 20 May 2017 09:53:15 -0300 Subject: [PATCH] Fix Timeoutless Job (#19266) --- src/Illuminate/Queue/Worker.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index 9de5796931eb..4b33c7b0fd61 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -131,7 +131,9 @@ public function daemon($connectionName, $queue, WorkerOptions $options) */ protected function registerTimeoutHandler($job, WorkerOptions $options) { - if ($options->timeout > 0 && $this->supportsAsyncSignals()) { + $timeout = $this->timeoutForJob($job, $options); + + if ($timeout > 0 && $this->supportsAsyncSignals()) { // We will register a signal handler for the alarm signal so that we can kill this // 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. @@ -139,7 +141,7 @@ protected function registerTimeoutHandler($job, WorkerOptions $options) $this->kill(1); }); - pcntl_alarm($this->timeoutForJob($job, $options) + $options->sleep); + pcntl_alarm($timeout + $options->sleep); } }