From ffee0b8799df8dc6c2537ea4d7e50884faee7591 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Fri, 19 Apr 2024 00:59:24 +0800 Subject: [PATCH] refactor: improve monitor retry logic. make sure send notice when retried --- src/server/model/monitor/runner.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/model/monitor/runner.ts b/src/server/model/monitor/runner.ts index 93f265e..bf9ec1f 100644 --- a/src/server/model/monitor/runner.ts +++ b/src/server/model/monitor/runner.ts @@ -63,6 +63,8 @@ export class MonitorRunner { // can be retry this.retriedNum++; } else { + this.retriedNum = 0; // make sure its will throw error in every retry times + // check event update if (value < 0 && currentStatus === 'UP') { // UP -> DOWN @@ -80,7 +82,6 @@ export class MonitorRunner { currentStatus = 'DOWN'; } else if (value > 0 && currentStatus === 'DOWN') { // DOWN -> UP - this.retriedNum = 0; await this.createEvent( 'UP', `Monitor [${monitor.name}] has been up`