改名
This commit is contained in:
@@ -106,18 +106,6 @@ class ClientsPool extends Component
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*/
|
||||
protected function clearCreateLog($name): void
|
||||
{
|
||||
if (!isset(static::$hasCreate[$name])) {
|
||||
return;
|
||||
}
|
||||
static::$hasCreate[$name] = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Channel $channel
|
||||
* @param $name
|
||||
@@ -140,12 +128,11 @@ class ClientsPool extends Component
|
||||
|
||||
|
||||
/**
|
||||
* @param $driver
|
||||
* @param $name
|
||||
* @param false $isMaster
|
||||
* @param int $max
|
||||
*/
|
||||
public function initConnections($driver, $name, bool $isMaster = false, int $max = 60)
|
||||
public function initConnections($name, bool $isMaster = false, int $max = 60)
|
||||
{
|
||||
$name = $this->name($name, $isMaster);
|
||||
if (isset(static::$_connections[$name]) && static::$_connections[$name] instanceof Channel) {
|
||||
|
||||
@@ -113,10 +113,14 @@ class Connection extends Component
|
||||
if (($pdo = Context::getContext($coroutineName)) instanceof PDO) {
|
||||
return $pdo;
|
||||
}
|
||||
/** @var PDO $connections */
|
||||
$connections = $this->getPool()->getFromChannel($coroutineName);
|
||||
if (empty($connections)) {
|
||||
if (Coroutine::getCid() === -1) {
|
||||
$connections = $this->createClient($coroutineName, $config);
|
||||
} else {
|
||||
/** @var PDO $connections */
|
||||
$connections = $this->getPool()->getFromChannel($coroutineName);
|
||||
if (empty($connections)) {
|
||||
$connections = $this->createClient($coroutineName, $config);
|
||||
}
|
||||
}
|
||||
if ($number = Context::getContext('begin_' . $coroutineName, Coroutine::getCid())) {
|
||||
$number > 0 && $connections->beginTransaction();
|
||||
@@ -125,6 +129,18 @@ class Connection extends Component
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $isMaster
|
||||
* @param $max
|
||||
* @throws Exception
|
||||
*/
|
||||
public function initConnections($name, $isMaster, $max)
|
||||
{
|
||||
$this->getPool()->initConnections($name, $isMaster, $max);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $config
|
||||
|
||||
@@ -126,4 +126,16 @@ class Redis extends Component
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $isMaster
|
||||
* @param $max
|
||||
* @throws Exception
|
||||
*/
|
||||
public function initConnections($name, $isMaster, $max)
|
||||
{
|
||||
$this->getPool()->initConnections($name, $isMaster, $max);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user