From add511ed2a3143cc5fa02bbdd6ad613a88153acb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 7 Feb 2023 17:05:21 +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 --- Connection.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Connection.php b/Connection.php index 0de9248..728c4fd 100644 --- a/Connection.php +++ b/Connection.php @@ -117,14 +117,14 @@ class Connection extends Component */ public function connectPoolInstance() { - if (!empty($this->slaveConfig) && $this->cds != $this->slaveConfig['cds']) { + if (!empty($this->slaveConfig) && isset($this->slaveConfig['cds'])) { $pool = $this->pool ?? ['max' => 10, 'min' => 1]; - $this->connection->initConnections('Mysql:' . $this->slaveConfig['cds'], $pool['max']); + $this->connection->initConnections($this->slaveConfig['cds'] . 'slave', $pool['max']); } else { $pool = $this->slaveConfig['pool'] ?? ['max' => 10, 'min' => 1]; - $this->connection->initConnections('Mysql:' . $this->cds, $pool['max']); + $this->connection->initConnections($this->cds . 'master', $pool['max']); } }