This commit is contained in:
2020-09-18 17:32:49 +08:00
parent 0b5dc1e237
commit df79a4fa13
2 changed files with 5 additions and 4 deletions
+3 -3
View File
@@ -198,9 +198,6 @@ class Connection extends Pool
*/
public function getConnection(array $config, $isMaster = false)
{
if ($this->creates === 0) {
$this->creates = Timer::tick(10000, [$this, 'Heartbeat_detection']);
}
$coroutineName = $this->name($config['cds'], $isMaster);
if (!isset($this->hasCreate[$coroutineName])) {
$this->hasCreate[$coroutineName] = 0;
@@ -243,6 +240,9 @@ class Connection extends Pool
if ($number = Context::getContext('begin_' . $coroutineName, Coroutine::getCid())) {
$number > 0 && $client->beginTransaction();
}
if ($this->creates === 0) {
$this->creates = Timer::tick(10000, [$this, 'Heartbeat_detection']);
}
return $client;
}