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
+3 -5
View File
@@ -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];
}