改名
This commit is contained in:
@@ -194,6 +194,9 @@ class Connection extends Component
|
||||
if (empty($this->slaveConfig) || Db::transactionsActive()) {
|
||||
return $this->masterInstance();
|
||||
}
|
||||
if ($this->slaveConfig['cds'] == $this->cds) {
|
||||
return $this->masterInstance();
|
||||
}
|
||||
return $this->connections()->get($this->slaveConfig, false);
|
||||
}
|
||||
|
||||
@@ -298,9 +301,9 @@ class Connection extends Component
|
||||
/**
|
||||
* @param $dbname
|
||||
* @param $sql
|
||||
* @return array|string|string[]|null
|
||||
* @return array|string|null
|
||||
*/
|
||||
private function selectMatch($dbname, $sql)
|
||||
private function selectMatch($dbname, $sql): array|string|null
|
||||
{
|
||||
return preg_replace('/FROM\s+(\w+)\s+/', 'FROM `' . $dbname . '`.$1 ', $sql);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,8 @@ class ClientsPool extends Component
|
||||
$this->flush($channel, $min);
|
||||
}
|
||||
$num[$key] += $channel->length();
|
||||
if (str_starts_with($key, 'Mysql') && (Snowflake::isWorker() || Snowflake::isTask())) {
|
||||
if (str_starts_with($key, 'Mysql') && (Snowflake::isWorker() || Snowflake::isTask())
|
||||
&& $channel->length() > 0) {
|
||||
$this->debug('Worker #' . env('worker') . ' use client -> ' . $key . ':' . $total);
|
||||
}
|
||||
$total += $channel->length();
|
||||
|
||||
Reference in New Issue
Block a user