From c17e829f75635e80c807f543ecdbd7efe7d8be1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 5 Jul 2021 11:06: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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/System/Abstracts/Pool.php b/System/Abstracts/Pool.php index a3743be6..0f13f56a 100644 --- a/System/Abstracts/Pool.php +++ b/System/Abstracts/Pool.php @@ -73,18 +73,19 @@ abstract class Pool extends Component /** * @throws Exception */ - public function Heartbeat_detection(string $name) + public function Heartbeat_detection(string $name, bool $isMaster) { + $name = $this->name('', $name, $isMaster); if (env('state') == 'exit') { Timer::clear($this->creates); $this->creates = -1; } else { $min = Config::get('databases.pool.min', 1); if (($length = $this->getChannel($name)->length()) > $min) { - $this->debug("$length -> min length $min"); + $this->debug("$name -> $length -> min length $min"); $this->flush($min); } else { - $this->debug("$length -> min length $min"); + $this->debug("$name -> $length -> min length $min"); } } } @@ -158,7 +159,7 @@ abstract class Pool extends Component return; } if ($this->creates === -1) { - $this->creates = Timer::tick(1000, [$this, 'Heartbeat_detection'], $name); + $this->creates = Timer::tick(1000, [$this, 'Heartbeat_detection'], $name, $isMaster); } static::$_items[$name] = new Channel($max); $this->max = $max;