Browse Source

Fix for push monitor logging UP statuses.

pull/699/head
Lukas 4 years ago
parent
commit
ac37326d9f
  1. 12
      server/model/monitor.js

12
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 {

Loading…
Cancel
Save