This commit is contained in:
2023-03-31 10:37:15 +08:00
parent 8cfcb18d6a
commit fdbf891fad
+4 -2
View File
@@ -100,13 +100,15 @@ class Connection extends Component
if (!$this->pool->hasChannel($name)) { if (!$this->pool->hasChannel($name)) {
$this->pool->initConnections($name, $config['pool']['max']); $this->pool->initConnections($name, $config['pool']['max']);
} }
if ($isMaster) {
return $this->pool->get($name, $this->generate($config));
if (!Context::hasContext($name)) { if (!Context::hasContext($name)) {
return Context::setContext($name, $this->pool->get($name, $this->generate($config))); return Context::setContext($name, $this->pool->get($name, $this->generate($config)));
} else { } else {
return Context::getContext($name); return Context::getContext($name);
} }
} else {
return $this->pool->get($name, $this->generate($config));
}
} }