This commit is contained in:
2021-08-17 18:53:37 +08:00
parent 14b83e418d
commit 3e256e5093
+6
View File
@@ -61,9 +61,15 @@ class Redis
*/ */
public function heartbeat_check(): void public function heartbeat_check(): void
{ {
if (env('state') == 'exit') {
return;
}
if ($this->_timer === -1 && Context::inCoroutine()) { if ($this->_timer === -1 && Context::inCoroutine()) {
$this->_timer = Timer::tick(3000, function () { $this->_timer = Timer::tick(3000, function () {
try { try {
if (env('state') == 'exit') {
$this->stopHeartbeatCheck();
}
if (time() - $this->_last > 10 * 60) { if (time() - $this->_last > 10 * 60) {
$this->stopHeartbeatCheck(); $this->stopHeartbeatCheck();
$this->pdo = null; $this->pdo = null;