变更
This commit is contained in:
@@ -97,7 +97,7 @@ class Connection extends Component
|
|||||||
public function get(mixed $config, bool $isMaster = false): ?\PDO
|
public function get(mixed $config, bool $isMaster = false): ?\PDO
|
||||||
{
|
{
|
||||||
$name = $config['cds'] . ($isMaster ? 'master' : 'slave');
|
$name = $config['cds'] . ($isMaster ? 'master' : 'slave');
|
||||||
if (!$this->pool->hasChannel($name, $config['pool']['max'])) {
|
if (!$this->pool->hasChannel($name)) {
|
||||||
$this->pool->initConnections($name, $config['pool']['max']);
|
$this->pool->initConnections($name, $config['pool']['max']);
|
||||||
}
|
}
|
||||||
return $this->pool->get($name, $this->generate($config));
|
return $this->pool->get($name, $this->generate($config));
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class Pool extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function hasChannel($name, $max): bool
|
public function hasChannel($name): bool
|
||||||
{
|
{
|
||||||
$channel = static::$_connections[$name] ?? null;
|
$channel = static::$_connections[$name] ?? null;
|
||||||
if (!($channel instanceof PoolQueue)) {
|
if (!($channel instanceof PoolQueue)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user