From df07ad18e2c7171d02092d675dbb304f9025d29b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 15 Apr 2021 11:57:52 +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/Abstracts/Pool.php | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/System/Abstracts/Pool.php b/System/Abstracts/Pool.php index 72e4081d..d76ca529 100644 --- a/System/Abstracts/Pool.php +++ b/System/Abstracts/Pool.php @@ -5,14 +5,9 @@ namespace Snowflake\Abstracts; use Exception; - use HttpServer\Http\Context; use JetBrains\PhpStorm\Pure; -use Phalcon\Mvc\Model\Query\Lang; -use Snowflake\Event; -use Snowflake\Exception\ComponentException; use Snowflake\Exception\ConfigException; -use Snowflake\Snowflake; use Swoole\Coroutine; use Swoole\Coroutine\Channel; use Swoole\Timer; @@ -52,17 +47,15 @@ abstract class Pool extends Component public function Heartbeat_detection() { if (env('state') == 'exit') { - $this->flush(0); - return; - } - if ($this->lastTime == 0) { - return; - } - [$firstClear, $lastClear] = $this->getClearTime(); - if ($this->lastTime + $firstClear < time()) { - $this->flush(0); - } else if ($this->lastTime + $lastClear < time()) { - $this->flush(2); + Timer::clear($this->creates); + $this->creates = -1; + } else if ($this->lastTime != 0) { + [$firstClear, $lastClear] = $this->getClearTime(); + if ($this->lastTime + $firstClear < time()) { + $this->flush(0); + } else if ($this->lastTime + $lastClear < time()) { + $this->flush(2); + } } }