This commit is contained in:
2021-02-15 10:22:47 +08:00
parent 2cbc28bc47
commit 14316d56ed
+2 -2
View File
@@ -120,7 +120,7 @@ abstract class Pool extends Component
*/ */
public function createConnect(array $config, string $coroutineName, callable $createHandler): PDO|Redis|null public function createConnect(array $config, string $coroutineName, callable $createHandler): PDO|Redis|null
{ {
if ($this->size($coroutineName) > 0) { if (!$this->hasItem($coroutineName)) {
return $this->get($coroutineName)[1]; return $this->get($coroutineName)[1];
} }
if (Context::hasContext('create:connect:' . $coroutineName)) { if (Context::hasContext('create:connect:' . $coroutineName)) {
@@ -134,7 +134,7 @@ abstract class Pool extends Component
return $client; return $client;
} }
$this->push($coroutineName, call_user_func($createHandler, ...$config)); $this->push($coroutineName, $client);
Context::deleteId('create:connect:' . $coroutineName); Context::deleteId('create:connect:' . $coroutineName);