This commit is contained in:
2021-02-20 12:29:12 +08:00
parent c718c341ae
commit 2fdefb43c9
2 changed files with 5 additions and 11 deletions
+2 -6
View File
@@ -48,11 +48,11 @@ class Redis extends Pool
return Context::getContext($coroutineName);
}
if (!$this->hasItem($coroutineName)) {
return $this->newClient($config, $coroutineName);
$this->newClient($config, $coroutineName);
}
[$time, $clients] = $this->get($coroutineName);
if ($clients === null) {
return $this->newClient($config, $coroutineName);
return $this->getConnection($config, $coroutineName);
}
return Context::setContext($coroutineName, $clients);
}
@@ -82,10 +82,6 @@ class Redis extends Pool
$redis->setOption(SRedis::OPT_READ_TIMEOUT, $config['read_timeout']);
$redis->setOption(SRedis::OPT_PREFIX, $config['prefix']);
if ($this->creates === 0) {
$this->creates = Timer::tick(1000, [$this, 'Heartbeat_detection']);
}
$this->_create += 1;
return $redis;