请教 RedisQueue 超时问题

0

使用以下代码报错,执行的业务逻辑是采集任务,有时候会重试时间稍长,偶发性出现Redis超时,之后就会出现一直连不上,请教一下该怎么解决,谢谢


$worker = new Worker();
$worker->count = 10;
$worker->onWorkerStart = function($worker)
{

$redisOptions = [
'db'=>2,
'wait_timeout' => '0',
'max_attempts' => '10',
'retry_seconds' => '10',
'wait_timeout' => '600000',
];
$client = new Client('redis://127.0.0.1:6379',$redisOptions);
$client->subscribe('task-eBay-item', function($data){
//执行业务逻辑
});
};

Warning: Invalid argument supplied for foreach() in /vendor/workerman/redis-queue/src/Client.php on line 177
Exception: Workerman Redis Connection Error 2 client closed in /vendor/workerman/redis/src/Client.php:346
Stack trace:
#0 /vendor/workerman/workerman/Connection/TcpConnection.php(370): Workerman\Redis\Client->Workerman\Redis\{closure}(Object(Workerman\Connection\AsyncTcpConnection), 2, 'client closed')
#1 /vendor/workerman/redis/src/Client.php(461): Workerman\Connection\TcpConnection->send('*4\r\n$4\r\nZADD\r\n$...')
#2 /vendor/workerman/redis/src/Client.php(423): Workerman\Redis\Client->process()
#3 /vendor/workerman/workerman/Connection/TcpConnection.php(637): Workerman\Redis\Client->Workerman\Redis\{closure}(Object(Workerman\Connection\AsyncTcpConnection), Array)
#4 [internal function]: Workerman\Connection\TcpConnection->baseRead(Resource id #52, 2, Resource id #52)
#5 /vendor/workerman/workerman/Events/Event.php(195): EventBase->loop()
#6 /vendor/workerman/workerman/Worker.php(2430): Workerman\Events\Event->loop()
#7 /vendor/workerman/workerman/Worker.php(1554): Workerman\Worker->run()
#8 /vendor/workerman/workerman/Worker.php(1384): Workerman\Worker::forkOneWorkerForLinux(Object(Workerman\Worker))
#9 /vendor/workerman/workerman/Worker.php(1358): Workerman\Worker::forkWorkersForLinux()
#10 /vendor/workerman/workerman/Worker.php(542): Workerman\Worker::forkWorkers()
#11 /task-item.php(129): Workerman\Worker::runAll()
#12 {main}Workerman Redis Connection to redis://127.0.0.1:6379 timeout (5 seconds)
Workerman Redis Connection to redis://127.0.0.1:6379 timeout (5 seconds)
Workerman Redis Connection to redis://127.0.0.1:6379 timeout (5 seconds)
Workerman Redis Connection to redis://127.0.0.1:6379 timeout (5 seconds)
Workerman Redis Connection to redis://127.0.0.1:6379 timeout (5 seconds)
已邀请:

要回复问题请先登录注册