From 764408eee661c498f2a8afd62f255d4dc00eb5ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Sat, 5 Sep 2020 02:01:31 +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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/System/Pool/Connection.php b/System/Pool/Connection.php index 760e8adb..7adcc95d 100644 --- a/System/Pool/Connection.php +++ b/System/Pool/Connection.php @@ -157,10 +157,12 @@ class Connection extends Pool return Context::getContext($coroutineName); } if ($this->size($coroutineName) < 1 && $this->hasCreate[$coroutineName] < $this->max) { - $this->info('client has create :' . ($this->hasCreate[$coroutineName] ?? 0) . ':' . $this->max); $this->push($coroutineName, $this->nowClient($coroutineName, $config)); } - return $this->get($coroutineName)[1]; + if (!(($client = $this->get($coroutineName)[1]) instanceof PDO)) { + throw new Exception('Connection pool overflow.'); + } + return $this->saveClient($coroutineName, $this->get($coroutineName)[1]); }