From 49cd2a55b3ffed1478e2a1c0805cad679c9abcc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Sat, 5 Sep 2020 01:26:11 +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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/System/Pool/Connection.php b/System/Pool/Connection.php index ed1f09c6..11220375 100644 --- a/System/Pool/Connection.php +++ b/System/Pool/Connection.php @@ -150,10 +150,14 @@ class Connection extends Pool public function getConnection(array $config, $isMaster = false) { [$coroutineId, $coroutineName] = $this->getIndex($config['cds'], $isMaster); + if (!isset($this->hasCreate[$coroutineName])) { + $this->hasCreate[$coroutineName] = 0; + } if (Context::hasContext($coroutineName)) { return Context::getContext($coroutineName); } if ($this->size($coroutineName) < 1) { + $this->info('client has create :' . ($this->hasCreate[$coroutineName] ?? 0) . ':' . $this->max); return $this->saveClient($coroutineName, $this->nowClient($coroutineName, $config)); } return $this->getByChannel($coroutineName, $config); @@ -187,7 +191,6 @@ class Connection extends Pool public function getByChannel($coroutineName, $config) { [$time, $client] = $this->get($coroutineName, -1); - $this->info('client has create :' . ($this->hasCreate[$coroutineName] ?? 0) . ':' . $this->max); if ($client instanceof PDO) { return $this->saveClient($coroutineName, $client); }