fix: move retry reset logic to api-router determineStatus
This commit is contained in:
parent
e6eb8f327b
commit
82d520e534
@ -447,20 +447,8 @@ class Monitor extends BeanModel {
|
||||
|
||||
if (!previousBeat || this.type === "push") {
|
||||
previousBeat = await R.findOne("heartbeat", " monitor_id = ? ORDER BY time DESC", [this.id]);
|
||||
|
||||
if (previousBeat) {
|
||||
retries = previousBeat.retries;
|
||||
|
||||
// We must check if the monitor is Upside Down (where UP=Bad, DOWN=Good)
|
||||
if (this.upsideDown) {
|
||||
if (previousBeat.status === DOWN) {
|
||||
retries = 0;
|
||||
}
|
||||
} else {
|
||||
if (previousBeat.status === UP) {
|
||||
retries = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -598,6 +598,13 @@ function determineStatus(status, previousHeartbeat, maxretries, isUpsideDown, be
|
||||
status = flipStatus(status);
|
||||
}
|
||||
|
||||
// This ensures that any previous retry count is cleared immediately when the monitor recovers.
|
||||
if (status === UP) {
|
||||
bean.retries = 0;
|
||||
bean.status = status;
|
||||
return;
|
||||
}
|
||||
|
||||
if (previousHeartbeat) {
|
||||
if (previousHeartbeat.status === UP && status === DOWN) {
|
||||
// Going Down
|
||||
|
||||
Loading…
Reference in New Issue
Block a user