This commit is contained in:
2021-07-12 18:51:41 +08:00
parent 16b300b139
commit 49f358fa93
6 changed files with 610 additions and 635 deletions
+3 -2
View File
@@ -32,7 +32,8 @@ class Connection extends Component
*/
public function inTransaction($cds): bool
{
return Context::getContext('begin_' . $this->getPool()->name('Mysql:' . $cds, true)) == 0;
$name = $this->getPool()->name('Mysql:' . $cds, true);
return Context::getContext('begin_' . $name) == 0;
}
/**
@@ -122,7 +123,7 @@ class Connection extends Component
$connections = $this->createClient($coroutineName, $config);
}
}
if ($number = Context::getContext('begin_' . $coroutineName, Coroutine::getCid())) {
if ($number = Context::getContext('begin_' . $coroutineName)) {
$number > 0 && $connections->beginTransaction();
}
return Context::setContext($coroutineName, $connections);