From c3d8a92b33095d593fb7652b6c1274219c7923aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 29 Jun 2021 14:26:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Abstracts/Pool.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/System/Abstracts/Pool.php b/System/Abstracts/Pool.php index 83e9db19..0b6ffd32 100644 --- a/System/Abstracts/Pool.php +++ b/System/Abstracts/Pool.php @@ -176,15 +176,13 @@ abstract class Pool extends Component if (!((static::$_items[$name] ?? null) instanceof Channel)) { static::$_items[$name] = $channel; } - if ($channel->isEmpty()) { - return $this->createClient($name, $callback); - } - $connection = $channel->pop(); - if (!$this->checkCanUse($name, $connection)) { - return $this->createClient($name, $callback); - } else { - return $connection; + if (!$channel->isEmpty()) { + $connection = $channel->pop(); + if ($this->checkCanUse($name, $connection)) { + return $connection; + } } + return $this->createClient($name, $callback); }