From 8e4f345091128215bf508d8514223430a374c609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Wed, 23 Feb 2022 18:48:49 +0800 Subject: [PATCH] modify plugin name --- kiri-engine/Pool/Connection.php | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/kiri-engine/Pool/Connection.php b/kiri-engine/Pool/Connection.php index 242db30d..41b7934d 100644 --- a/kiri-engine/Pool/Connection.php +++ b/kiri-engine/Pool/Connection.php @@ -90,25 +90,12 @@ class Connection extends Component public function get(mixed $config, bool $isMaster = false): ?PDO { $coroutineName = $this->name('Mysql:' . $config['cds'], $isMaster); - if ($isMaster == false) { - return $this->_get($config, $coroutineName); - } - if (!(($pdo = Context::getContext($coroutineName)) instanceof PDO)) { - $pdo = Context::setContext($coroutineName, $this->_get($config, $coroutineName)); - } - return $pdo; - } + $connection = Context::getContext($coroutineName); + if ($connection instanceof PDO) { + return $connection; + } - /** - * @param mixed $config - * @param string $coroutineName - * @return PDO - * @throws Kiri\Exception\ConfigException - * @throws Exception - */ - private function _get(mixed $config, string $coroutineName): PDO - { $minx = Config::get('databases.pool.min', 1); /** @var PDO $connections */ @@ -120,6 +107,7 @@ class Connection extends Component } + /** * @param $coroutineName * @param $config