From ac37326d9f61bd2b323d4cb0595a6949ff0f9c79 Mon Sep 17 00:00:00 2001 From: Lukas <35193662+NixNotCastey@users.noreply.github.com> Date: Wed, 13 Oct 2021 21:37:21 +0200 Subject: [PATCH] Fix for push monitor logging UP statuses. --- server/model/monitor.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 1618152..79c7244 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -244,20 +244,20 @@ class Monitor extends BeanModel { } else if (this.type === "push") { // Type: Push const time = R.isoDateTime(dayjs.utc().subtract(this.interval, "second")); - let heartbeatCount = await R.count("heartbeat", " monitor_id = ? AND time > ? ", [ + let heartbeatCount = await R.count("heartbeat", " monitor_id = ? AND time > ? AND msg = ? ", [ this.id, - time + time, + "OK" ]); - debug("heartbeatCount" + heartbeatCount + " " + time); + debug("heartbeatCount " + heartbeatCount + " " + time); if (heartbeatCount <= 0) { throw new Error("No heartbeat in the time window"); } else { - // No need to insert successful heartbeat for push type, so end here retries = 0; - this.heartbeatInterval = setTimeout(beat, this.interval * 1000); - return; + bean.status = UP; + bean.msg = ""; } } else {