From 5ca5768f9f331d4da8a1b8378a7abd3730d4041a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Sat, 5 Sep 2020 03:08:39 +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/Abstracts/Pool.php | 2 ++ System/Pool/Connection.php | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/System/Abstracts/Pool.php b/System/Abstracts/Pool.php index c0e66727..5349e8c2 100644 --- a/System/Abstracts/Pool.php +++ b/System/Abstracts/Pool.php @@ -43,6 +43,7 @@ abstract class Pool extends Component */ protected function get($name) { + $this->debug('get connect.' . $this->size($name)); [$timeout, $connection] = $this->_items[$name]->pop(); if (!$this->checkCanUse($name, $timeout, $connection)) { unset($client); @@ -125,6 +126,7 @@ abstract class Pool extends Component public function push($name, $client) { $this->_items[$name]->push([time(), $client]); + unset($client); $this->debug('release connect.' . $this->size($name)); } diff --git a/System/Pool/Connection.php b/System/Pool/Connection.php index 18aef57b..e59aab27 100644 --- a/System/Pool/Connection.php +++ b/System/Pool/Connection.php @@ -156,7 +156,8 @@ class Connection extends Pool if (Context::hasContext($coroutineName)) { return Context::getContext($coroutineName); } - if ($this->size($coroutineName) < 1 && $this->hasCreate[$coroutineName] < $this->max) { + if ($this->size($coroutineName) < 1) { +// if ($this->size($coroutineName) < 1 && $this->hasCreate[$coroutineName] < $this->max) { return $this->saveClient($coroutineName, $this->nowClient($coroutineName, $config)); } [$timeout, $connection] = $client = $this->get($coroutineName);