From 9c8c8c6bb3e788efee73f0f72aecc2a5f5cc1c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 29 Aug 2023 21:46:05 +0800 Subject: [PATCH] eee --- Connection.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Connection.php b/Connection.php index c1174a0..128131f 100644 --- a/Connection.php +++ b/Connection.php @@ -63,6 +63,8 @@ class Connection extends Component private int $storey = 0; + protected int $timerId = -1; + /** * @var bool * enable database cache @@ -127,7 +129,7 @@ class Connection extends Component */ public function tick(): void { - Timer::tick(120000, fn() => $this->checkClientHealth($this->pool())); + $this->timerId = Timer::tick(120000, fn() => $this->checkClientHealth($this->pool())); } @@ -390,6 +392,9 @@ class Connection extends Component */ public function disconnect(): void { + if ($this->timerId > -1) { + Timer::clear($this->timerId); + } $this->pool()->close($this->cds); }