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; }