refactor: improve monitor retry logic. make sure send notice when retried
This commit is contained in:
parent
a73720411c
commit
ffee0b8799
@ -63,6 +63,8 @@ export class MonitorRunner {
|
|||||||
// can be retry
|
// can be retry
|
||||||
this.retriedNum++;
|
this.retriedNum++;
|
||||||
} else {
|
} else {
|
||||||
|
this.retriedNum = 0; // make sure its will throw error in every retry times
|
||||||
|
|
||||||
// check event update
|
// check event update
|
||||||
if (value < 0 && currentStatus === 'UP') {
|
if (value < 0 && currentStatus === 'UP') {
|
||||||
// UP -> DOWN
|
// UP -> DOWN
|
||||||
@ -80,7 +82,6 @@ export class MonitorRunner {
|
|||||||
currentStatus = 'DOWN';
|
currentStatus = 'DOWN';
|
||||||
} else if (value > 0 && currentStatus === 'DOWN') {
|
} else if (value > 0 && currentStatus === 'DOWN') {
|
||||||
// DOWN -> UP
|
// DOWN -> UP
|
||||||
this.retriedNum = 0;
|
|
||||||
await this.createEvent(
|
await this.createEvent(
|
||||||
'UP',
|
'UP',
|
||||||
`Monitor [${monitor.name}] has been up`
|
`Monitor [${monitor.name}] has been up`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user