From 2e6ca9b4fa3bc9478d6acf8c1d8e30eb236b36e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 29 Jun 2021 14:36:45 +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/Pool/Connection.php | 2 ++ System/Pool/Redis.php | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/System/Pool/Connection.php b/System/Pool/Connection.php index 2edf4293..a9f988ed 100644 --- a/System/Pool/Connection.php +++ b/System/Pool/Connection.php @@ -175,6 +175,7 @@ class Connection extends Pool $client->commit(); } $this->push($coroutineName, $client); + Context::remove($coroutineName); $this->lastTime = time(); } @@ -231,6 +232,7 @@ class Connection extends Pool */ public function disconnect($coroutineName, bool $isMaster = false) { + Context::remove($coroutineName); $coroutineName = $this->name($coroutineName, $isMaster); $this->clean($coroutineName); } diff --git a/System/Pool/Redis.php b/System/Pool/Redis.php index 00749302..d0abb979 100644 --- a/System/Pool/Redis.php +++ b/System/Pool/Redis.php @@ -51,7 +51,7 @@ class Redis extends Pool * @return mixed * @throws Exception */ - public function get(mixed $config, $isMaster = false): mixed + public function get(mixed $config, bool $isMaster = false): mixed { $name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases']; $coroutineName = $this->name('redis', 'redis:' . $name, $isMaster); @@ -98,7 +98,7 @@ class Redis extends Pool * @param array $config * @param bool $isMaster */ - public function release(array $config, $isMaster = false) + public function release(array $config, bool $isMaster = false) { $name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases']; $coroutineName = $this->name('redis', 'redis:' . $name, $isMaster); @@ -116,7 +116,7 @@ class Redis extends Pool * @param bool $isMaster * @throws Exception */ - public function destroy(array $config, $isMaster = false) + public function destroy(array $config, bool $isMaster = false) { $name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases']; $coroutineName = $this->name('redis', 'redis:' . $name, $isMaster);