From 0b3b7bdbda290a91bba7d86cf4e0da551733f037 Mon Sep 17 00:00:00 2001 From: zhenghongyang Date: Sun, 12 Apr 2020 14:58:59 +0800 Subject: [PATCH] igr close connection error --- src/connection-pool/src/AbstractPool.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/connection-pool/src/AbstractPool.php b/src/connection-pool/src/AbstractPool.php index 91d55a0f6..88d60496b 100644 --- a/src/connection-pool/src/AbstractPool.php +++ b/src/connection-pool/src/AbstractPool.php @@ -164,7 +164,12 @@ public function close(): int continue; } - $connection->close(); + try { + // May be disconnected + $connection->close(); + } catch (Throwable $e) { + CLog::warning('Pool close connection error ' . $e->getMessage()); + } } return $this->count; @@ -275,8 +280,12 @@ private function popByChannel(): ?ConnectionInterface // Out of `maxIdleTime` if ($time - $lastTime > $this->maxIdleTime) { - // Fix expired connection not released - $connection->close(); + try { + // Fix expired connection not released, May be disconnected + $connection->close(); + } catch (Throwable $e) { + CLog::warning('popByChannel close connection error ' . $e->getMessage()); + } $this->count--; continue;