改名
This commit is contained in:
@@ -120,6 +120,7 @@ class Pool extends Component
|
|||||||
$channel = $this->getChannel($name);
|
$channel = $this->getChannel($name);
|
||||||
if (!$channel->isEmpty()) {
|
if (!$channel->isEmpty()) {
|
||||||
$connection = $channel->pop();
|
$connection = $channel->pop();
|
||||||
|
defer(fn() => $this->maxIdleQuantity($channel));
|
||||||
if ($this->checkCanUse($name, $connection)) {
|
if ($this->checkCanUse($name, $connection)) {
|
||||||
return $connection;
|
return $connection;
|
||||||
}
|
}
|
||||||
@@ -128,6 +129,20 @@ class Pool extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $channel
|
||||||
|
* @throws ConfigException
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private function maxIdleQuantity($channel): void
|
||||||
|
{
|
||||||
|
$minx = Config::get('databases.pool.min', 1);
|
||||||
|
if ($channel->length() > $minx) {
|
||||||
|
$this->pop($channel, $minx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $name
|
* @param $name
|
||||||
* @return bool
|
* @return bool
|
||||||
|
|||||||
Reference in New Issue
Block a user