This commit is contained in:
2023-02-07 17:16:10 +08:00
parent 4f341594b5
commit d83f061a1c
2 changed files with 19 additions and 2 deletions
+5 -1
View File
@@ -96,7 +96,11 @@ class Connection extends Component
*/
public function get(mixed $config, bool $isMaster = false): ?\PDO
{
return $this->pool->get($config['cds'] . ($isMaster ? 'master' : 'slave'), $this->generate($config));
$name = $config['cds'] . ($isMaster ? 'master' : 'slave');
if (!$this->pool->hasChannel($name, $config['pool']['max'])) {
$this->pool->initConnections($name, $config['pool']['max']);
}
return $this->pool->get($name, $this->generate($config));
}