Skip to content

Commit

Permalink
Update RedisConnection.php
Browse files Browse the repository at this point in the history
  • Loading branch information
walkor authored Jun 3, 2022
1 parent 27d2280 commit 4c900f8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/RedisConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Webman\RedisQueue;

use Workerman\Timer;
use Workerman\Worker;

class RedisConnection extends \Redis
{
Expand Down Expand Up @@ -41,7 +42,7 @@ public function connectWithConfig(array $config = [])
if (!empty($this->config['db'])) {
$this->select($this->config['db']);
}
if (!$timer) {
if (Worker::getAllWorkers() && !$timer) {
$timer = Timer::add($this->config['ping'] ?? 55, function () {
$this->execCommand('ping');
});
Expand Down

0 comments on commit 4c900f8

Please sign in to comment.