From 15214aa07e5a62c0332a58c6bfb7be98a11ad0ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 19 Sep 2022 18:39:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kiri-engine/Pool/Connection.php | 8 ++++++++ kiri-engine/Pool/Pool.php | 12 +++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/kiri-engine/Pool/Connection.php b/kiri-engine/Pool/Connection.php index f8855b38..5063aed5 100644 --- a/kiri-engine/Pool/Connection.php +++ b/kiri-engine/Pool/Connection.php @@ -186,6 +186,14 @@ class Connection extends Component } + /** + * @throws Exception + */ + public function flush($coroutineName, $minNumber = 1) { + $this->pool->flush($coroutineName, $minNumber); + } + + /** * @param $coroutineName * @return bool diff --git a/kiri-engine/Pool/Pool.php b/kiri-engine/Pool/Pool.php index e732ac69..a26e676c 100644 --- a/kiri-engine/Pool/Pool.php +++ b/kiri-engine/Pool/Pool.php @@ -41,12 +41,13 @@ class Pool extends Component /** - * @param $channel + * @param $name * @param $retain_number * @throws Exception */ - public function flush($channel, $retain_number) + public function flush($name, $retain_number) { + $channel = $this->channel($name); $this->pop($channel, $retain_number); } @@ -175,16 +176,13 @@ class Pool extends Component /** * @param $channel * @param $minx - * @return mixed - * @throws Exception + * @return void */ - protected function maxIdleQuantity($channel, $minx): mixed + protected function maxIdleQuantity($channel, $minx): void { - $connection = $channel->pop(); if ($channel->length() > $minx) { $this->pop($channel, $minx); } - return $connection; }