modify plugin name

This commit is contained in:
2022-02-23 18:48:49 +08:00
parent 70a5a5ea59
commit 8e4f345091
+5 -17
View File
@@ -90,25 +90,12 @@ class Connection extends Component
public function get(mixed $config, bool $isMaster = false): ?PDO public function get(mixed $config, bool $isMaster = false): ?PDO
{ {
$coroutineName = $this->name('Mysql:' . $config['cds'], $isMaster); $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); $minx = Config::get('databases.pool.min', 1);
/** @var PDO $connections */ /** @var PDO $connections */
@@ -120,6 +107,7 @@ class Connection extends Component
} }
/** /**
* @param $coroutineName * @param $coroutineName
* @param $config * @param $config