From d5f9df7a084ec2302f52d4e50e2de6d8325c20c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 17 Aug 2021 18:53:37 +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 --- src/Mysql/PDO.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mysql/PDO.php b/src/Mysql/PDO.php index 57ec411..9e77827 100644 --- a/src/Mysql/PDO.php +++ b/src/Mysql/PDO.php @@ -68,9 +68,15 @@ class PDO */ public function heartbeat_check(): void { + if (env('state') == 'exit') { + return; + } if ($this->_timer === -1 && Context::inCoroutine()) { - $this->_timer = Timer::tick(3000, function () { + $this->_timer = Timer::tick(1000, function () { try { + if (env('state') == 'exit') { + $this->stopHeartbeatCheck(); + } if (time() - $this->_last > 10 * 60) { $this->stopHeartbeatCheck(); $this->pdo = null;