From 4ab5ccae8fa2bcfd606547011751a367a70024e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Sat, 20 Feb 2021 12:30:35 +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 | 4 ++-- System/Pool/Redis.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/System/Pool/Connection.php b/System/Pool/Connection.php index ff526e93..4a5817ee 100644 --- a/System/Pool/Connection.php +++ b/System/Pool/Connection.php @@ -149,8 +149,8 @@ class Connection extends Pool if (!isset($this->hasCreate[$coroutineName])) { $this->hasCreate[$coroutineName] = 0; } - if (Context::hasContext($coroutineName)) { - return Context::getContext($coroutineName); + if (($pdo = Context::getContext($coroutineName)) instanceof PDO) { + return $pdo; } if (!$this->hasItem($coroutineName)) { $this->newClient($config, $coroutineName); diff --git a/System/Pool/Redis.php b/System/Pool/Redis.php index 4f5529db..9941716c 100644 --- a/System/Pool/Redis.php +++ b/System/Pool/Redis.php @@ -44,8 +44,8 @@ class Redis extends Pool { $name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases']; $coroutineName = $this->name('redis:' . $name, $isMaster); - if (Context::hasContext($coroutineName)) { - return Context::getContext($coroutineName); + if (($redis = Context::getContext($coroutineName)) instanceof \Redis) { + return $redis; } if (!$this->hasItem($coroutineName)) { $this->newClient($config, $coroutineName);