This commit is contained in:
2023-04-03 00:14:29 +08:00
parent dcf4de9900
commit fb851bbfc1
2 changed files with 20 additions and 1 deletions
+7 -1
View File
@@ -25,6 +25,8 @@ class Connection extends Component
private array $master = [];
private int $total = 0;
/**
* @param Pool $pool
@@ -150,7 +152,11 @@ class Connection extends Component
*/
public function create($config): Closure
{
return static function () use ($config) {
return function () use ($config) {
if ($this->total >= 300) {
return $this->pool->waite($config['cds'], 30);
}
$this->total += 1;
return new \Database\Mysql\PDO($config);
};
}