改名
This commit is contained in:
+13
-1
@@ -77,6 +77,7 @@ class Redis extends Pool
|
||||
*/
|
||||
private function newClient($config, $coroutineName): \Redis|null
|
||||
{
|
||||
$this->printClients($config['cds'], $coroutineName, true);
|
||||
return $this->createConnect([$config, $coroutineName], $coroutineName, function ($config, $coroutineName) {
|
||||
$redis = new SRedis();
|
||||
if (!$redis->connect($config['host'], (int)$config['port'], $config['timeout'])) {
|
||||
@@ -85,7 +86,7 @@ class Redis extends Pool
|
||||
if (empty($config['auth']) || !$redis->auth($config['auth'])) {
|
||||
throw new RedisConnectException(sprintf('Redis Error: %s, Host %s, Auth %s', $redis->getLastError(), $config['host'], $config['auth']));
|
||||
}
|
||||
$this->success('create client[address: ' . $config['host'] . ', coroutine: ' . Coroutine::getCid() . ', has num: ' . $this->size($coroutineName) . ', has create: ' . $this->_create . ']');
|
||||
$this->printClients($config['host'], $coroutineName);
|
||||
if (!isset($config['read_timeout'])) {
|
||||
$config['read_timeout'] = 10;
|
||||
}
|
||||
@@ -98,6 +99,17 @@ class Redis extends Pool
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $cds
|
||||
* @param $coroutineName
|
||||
* @param false $isBefore
|
||||
*/
|
||||
public function printClients($cds, $coroutineName, $isBefore = false)
|
||||
{
|
||||
$this->success(($isBefore ? 'before ' : '') . 'create client[address: ' . $cds . ', coroutine: ' . Coroutine::getCid() . ', has num: ' . $this->size($coroutineName) . ', has create: ' . $this->hasCreate[$coroutineName] . ']');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $coroutineName
|
||||
* @param $client
|
||||
|
||||
Reference in New Issue
Block a user