From 6006038689491d2f2b4407bf1c00aaf28c8b27f1 Mon Sep 17 00:00:00 2001 From: LouisLam Date: Wed, 8 Sep 2021 20:00:16 +0800 Subject: [PATCH] fix monitor.stop() in some cases --- server/model/monitor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 19f21d92..cc9ab454 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -309,7 +309,10 @@ class Monitor extends BeanModel { previousBeat = bean; - this.heartbeatInterval = setTimeout(beat, this.interval * 1000); + if (! this.isStop) { + this.heartbeatInterval = setTimeout(beat, this.interval * 1000); + } + } beat(); @@ -317,6 +320,7 @@ class Monitor extends BeanModel { stop() { clearTimeout(this.heartbeatInterval); + this.isStop = true; } /**