Skip to content

Commit

Permalink
Apply old PR 243
Browse files Browse the repository at this point in the history
  • Loading branch information
danhunsaker committed Dec 11, 2018
1 parent dec0d9c commit 6421998
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/Resque/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)
break;
}

// is redis still alive?
try {
if (Resque::redis()->ping() === false) {
throw new CredisException('redis ping() failed');
}
} catch (CredisException $e) {
$this->logger->log(Psr\Log\LogLevel::ERROR, 'redis went away. trying to reconnect');
Resque::$redis = null;
usleep($interval * 1000000);
continue;
}

// Attempt to find and reserve a job
$job = false;
if(!$this->paused) {
Expand Down

0 comments on commit 6421998

Please sign in to comment.