From 1370891b934478dd900d00ea8d593d55b90f209d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 4 Apr 2023 14:44:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mysql/PDO.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Mysql/PDO.php b/Mysql/PDO.php index 56179f4..f70cd01 100644 --- a/Mysql/PDO.php +++ b/Mysql/PDO.php @@ -364,9 +364,12 @@ class PDO implements StopHeartbeatCheck */ private function newClient(): \PDO { + while ($this->group->count() > 0) { + Coroutine::sleep(0.0001); + } $this->group->add(); Coroutine::create(function () { - \Co\defer(function () { + Coroutine::defer(function () { $this->group->done(); }); $link = new \PDO('mysql:dbname=' . $this->dbname . ';host=' . $this->cds, $this->username, $this->password, [