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