From 37b745b659eb9d5f3c7f51f351fb3e0f3b14326d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 5 Jul 2021 15:51: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/Pool/ClientsPool.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/System/Pool/ClientsPool.php b/System/Pool/ClientsPool.php index 834cccc4..ab2d31ac 100644 --- a/System/Pool/ClientsPool.php +++ b/System/Pool/ClientsPool.php @@ -80,9 +80,12 @@ class ClientsPool extends Component $this->creates = -1; } else { $min = Config::get('databases.pool.min', 1); - if ($this->getChannel($name)->length() > $min) { + + $length = $this->getChannel($name)->length(); + if ($length > $min) { $this->flush($min); } + $this->debug("$name -> ($length:$min)"); } } @@ -142,7 +145,7 @@ class ClientsPool extends Component return; } if ($this->creates === -1) { - $this->creates = Timer::tick(1000, [$this, 'Heartbeat_detection'], $name); + $this->creates = Timer::tick(30000, [$this, 'Heartbeat_detection'], $name); } static::$_connections[$name] = new Channel($max); $this->max = $max;