This commit is contained in:
2021-04-15 11:57:52 +08:00
parent c49091b13e
commit df07ad18e2
+4 -11
View File
@@ -5,14 +5,9 @@ namespace Snowflake\Abstracts;
use Exception; use Exception;
use HttpServer\Http\Context; use HttpServer\Http\Context;
use JetBrains\PhpStorm\Pure; use JetBrains\PhpStorm\Pure;
use Phalcon\Mvc\Model\Query\Lang;
use Snowflake\Event;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\ConfigException; use Snowflake\Exception\ConfigException;
use Snowflake\Snowflake;
use Swoole\Coroutine; use Swoole\Coroutine;
use Swoole\Coroutine\Channel; use Swoole\Coroutine\Channel;
use Swoole\Timer; use Swoole\Timer;
@@ -52,12 +47,9 @@ abstract class Pool extends Component
public function Heartbeat_detection() public function Heartbeat_detection()
{ {
if (env('state') == 'exit') { if (env('state') == 'exit') {
$this->flush(0); Timer::clear($this->creates);
return; $this->creates = -1;
} } else if ($this->lastTime != 0) {
if ($this->lastTime == 0) {
return;
}
[$firstClear, $lastClear] = $this->getClearTime(); [$firstClear, $lastClear] = $this->getClearTime();
if ($this->lastTime + $firstClear < time()) { if ($this->lastTime + $firstClear < time()) {
$this->flush(0); $this->flush(0);
@@ -65,6 +57,7 @@ abstract class Pool extends Component
$this->flush(2); $this->flush(2);
} }
} }
}
/** /**