This commit is contained in:
2022-09-19 18:39:28 +08:00
parent 9bf6d000ed
commit 15214aa07e
2 changed files with 13 additions and 7 deletions
+8
View File
@@ -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
+5 -7
View File
@@ -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;
}