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);