diff --git a/System/Pool/Connection.php b/System/Pool/Connection.php index 15f95942..ff526e93 100644 --- a/System/Pool/Connection.php +++ b/System/Pool/Connection.php @@ -153,11 +153,11 @@ class Connection extends Pool return Context::getContext($coroutineName); } if (!$this->hasItem($coroutineName)) { - return $this->newClient($config, $coroutineName); + $this->newClient($config, $coroutineName); } [$time, $connections] = $this->get($coroutineName); if (!($connections instanceof PDO)) { - return $this->newClient($config, $coroutineName); + return $this->getConnection($config, $coroutineName); } return Context::setContext($coroutineName, $connections); } @@ -166,10 +166,9 @@ class Connection extends Pool /** * @param $config * @param $coroutineName - * @return PDO|null * @throws Exception */ - private function newClient($config, $coroutineName): PDO|null + private function newClient($config, $coroutineName) { $this->printClients($config['cds'], $coroutineName, true); $this->createConnect($this->parseConfig($config, $coroutineName), $coroutineName, function ($cds, $username, $password, $charset, $coroutineName) { @@ -193,7 +192,6 @@ class Connection extends Pool } return $link; }); - return $this->get($coroutineName)[1]; } diff --git a/System/Pool/Redis.php b/System/Pool/Redis.php index d8049319..4f5529db 100644 --- a/System/Pool/Redis.php +++ b/System/Pool/Redis.php @@ -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;