diff --git a/System/Abstracts/Pool.php b/System/Abstracts/Pool.php index 03074a83..663ef8ab 100644 --- a/System/Abstracts/Pool.php +++ b/System/Abstracts/Pool.php @@ -45,7 +45,6 @@ abstract class Pool extends Component } - /** * @param $name * @return array @@ -68,7 +67,6 @@ abstract class Pool extends Component } - /** * @param $cds * @param false $isMaster @@ -126,13 +124,13 @@ abstract class Pool extends Component */ public function createConnect(array $config, string $coroutineName, callable $createHandler): PDO|Redis|false { - if (Context::hasContext('create:connect:' . $coroutineName)) { - while (($client = Context::getContext($coroutineName)) != null){ - var_dump($client); - } - var_dump($client); + if ($client = Context::getContext($coroutineName)) { return $client; } + if (Context::hasContext('create:connect:' . $coroutineName)) { + Coroutine::sleep(0.001); + return $this->createConnect($config, $coroutineName, $createHandler); + } Context::setContext('create:connect:' . $coroutineName, 1); $client = call_user_func($createHandler, ...$config);