From 27297e29fdaed5b7af9edd39067a5b9bf67a1f92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 9 Aug 2021 11:06:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Pool/Connection.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/System/Pool/Connection.php b/System/Pool/Connection.php index d72f88c1..396f9455 100644 --- a/System/Pool/Connection.php +++ b/System/Pool/Connection.php @@ -46,9 +46,6 @@ class Connection extends Component if (!Context::hasContext('begin_' . $coroutineName)) { Context::setContext('begin_' . $coroutineName, 0); } - if (Context::increment('begin_' . $coroutineName) != 0) { - return; - } $connection = Context::getContext($coroutineName); if ($connection instanceof PDO && !$connection->inTransaction()) { $connection->beginTransaction(); @@ -104,8 +101,8 @@ class Connection extends Component } /** @var PDO $connections */ $connections = $this->getPool()->get($coroutineName, $this->create($coroutineName, $config)); - if ($number = Context::getContext('begin_' . $coroutineName)) { - $number > 0 && $connections->beginTransaction(); + if (Context::hasContext('begin_' . $coroutineName)) { + $connections->beginTransaction(); } return Context::setContext($coroutineName, $connections); }