From a659375e1f68efefe63b61877c053800dd32d972 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Fri, 31 Mar 2023 23:44:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kiri-engine/Pool/Connection.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/kiri-engine/Pool/Connection.php b/kiri-engine/Pool/Connection.php index c9008988..8cf1865b 100644 --- a/kiri-engine/Pool/Connection.php +++ b/kiri-engine/Pool/Connection.php @@ -94,16 +94,15 @@ class Connection extends Component * @return PDO|null * @throws Kiri\Exception\ConfigException */ - public function get(mixed $config, bool $isMaster = false): ?\PDO + public function get(mixed $config): ?\PDO { - $name = $config['cds'] . ($isMaster ? 'master' : 'slave'); - if (!$this->pool->hasChannel($name)) { - $this->pool->initConnections($name, $config['pool']['max']); + if (!$this->pool->hasChannel($config['cds'])) { + $this->pool->initConnections($config['cds'], $config['pool']['max']); } - if (!Context::hasContext($name)) { - return Context::setContext($name, $this->pool->get($name, $this->generate($config))); + if (!Context::hasContext($config['cds'])) { + return Context::setContext($config['cds'], $this->pool->get($config['cds'], $this->generate($config))); } else { - return Context::getContext($name); + return Context::getContext($config['cds']); } }