Skip to content

Commit

Permalink
重连
Browse files Browse the repository at this point in the history
  • Loading branch information
mrHe committed Jun 18, 2021
1 parent e7e720b commit 572282e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Resque.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,19 @@ public static function redis()
}
}

if (!self::$redis->ping()) {
try {
if (!self::$redis->ping()) {
throw new \Exception('need retry');
}
} catch (\Throwable $e) {
if (self::$redisRetry < 3) {
self::$redis = null;
sleep(self::$redisRetry);
return self::redis();
}
}


return self::$redis;
}

Expand Down

0 comments on commit 572282e

Please sign in to comment.