From 782d4a6a77cb2e5200bf937380a0950c34db6f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 12 Aug 2021 17:20:20 +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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/System/Pool/Connection.php b/System/Pool/Connection.php index 98e699ce..8f56687f 100644 --- a/System/Pool/Connection.php +++ b/System/Pool/Connection.php @@ -6,9 +6,9 @@ namespace Kiri\Pool; use Closure; use Exception; use HttpServer\Http\Context; -use PDO; use Kiri\Abstracts\Component; use Kiri\Kiri; +use PDO; use Swoole\Coroutine; use Swoole\Error; use Swoole\Runtime; @@ -100,11 +100,17 @@ class Connection extends Component if (($pdo = Context::getContext($coroutineName)) instanceof PDO) { return $pdo; } + + debug('mysql connect startTime ' . microtime(true)); + /** @var PDO $connections */ $connections = $this->getPool()->get($coroutineName, $this->create($coroutineName, $config)); if (Context::hasContext('begin_' . $coroutineName)) { $connections->beginTransaction(); } + + debug('mysql connect endTime ' . microtime(true)); + return Context::setContext($coroutineName, $connections); }