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