From 29813082f83696eaf47ee01729a73c9a361e32e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 25 Aug 2023 09:39:52 +0800 Subject: [PATCH] qqq --- Pool.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Pool.php b/Pool.php index f516da6..fb1a7c5 100644 --- a/Pool.php +++ b/Pool.php @@ -5,6 +5,7 @@ namespace Kiri\Pool; use Exception; +use Kiri\Di\Context; /** @@ -69,7 +70,7 @@ class Pool implements PoolInterface throw new Exception('Channel is not exists.'); } $channel = $this->_connections[$name]; - if ($channel == null || $channel->isClose()) { + if ($channel->isClose()) { $channel->reconnect(); } return $channel; @@ -189,11 +190,12 @@ class Pool implements PoolInterface */ public function close(string $name): void { - $channel = $this->_connections[$name] ?? null; - if ($channel === null) { + if (!isset($this->_connections[$name])) { return; } - $this->_connections[$name] = null; + if (Context::inCoroutine()) { + $this->_connections[$name]->close(); + } }