From 65ff08b38e4c6affba40d1d6171df7968107d2ed Mon Sep 17 00:00:00 2001 From: Neel Bhanushali Date: Sun, 11 Feb 2024 20:19:56 +0530 Subject: [PATCH 1/4] lower heartbeat interval when monitor is down #4025 From a16b42f98c5bbbdcd6fc057d791609948c2c4d0d Mon Sep 17 00:00:00 2001 From: Neel Bhanushali Date: Sun, 11 Feb 2024 21:33:58 +0530 Subject: [PATCH 2/4] poc done --- server/model/monitor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index b2fed86f5..140a9442c 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -606,7 +606,9 @@ class Monitor extends BeanModel { if (result.toString() === this.expectedValue) { bean.msg += ", expected value is found"; bean.status = UP; + console.log('json-query successful') } else { + console.log('json-query unsuccessful') throw new Error(bean.msg + ", but value is not equal to expected value, value was: [" + result + "]"); } } @@ -898,7 +900,7 @@ class Monitor extends BeanModel { retries = 0; } catch (error) { - + console.log('came in catch') if (error?.name === "CanceledError") { bean.msg = `timeout by AbortSignal (${this.timeout}s)`; } else { @@ -913,6 +915,7 @@ class Monitor extends BeanModel { } else if ((this.maxretries > 0) && (retries < this.maxretries)) { retries++; bean.status = PENDING; + console.log('checking retries', retries, this.maxretries) } else { // Continue counting retries during DOWN retries++; @@ -971,6 +974,7 @@ class Monitor extends BeanModel { } else if (bean.status === MAINTENANCE) { log.warn("monitor", `Monitor #${this.id} '${this.name}': Under Maintenance | Type: ${this.type}`); } else { + beatInterval = this.retryInterval log.warn("monitor", `Monitor #${this.id} '${this.name}': Failing: ${bean.msg} | Interval: ${beatInterval} seconds | Type: ${this.type} | Down Count: ${bean.downCount} | Resend Interval: ${this.resendInterval}`); } From a5d0f7a7db9ddc4863731c86895b66664c0055a2 Mon Sep 17 00:00:00 2001 From: Neel Bhanushali Date: Sun, 11 Feb 2024 21:37:45 +0530 Subject: [PATCH 3/4] console added with double quotes and semicolons. console added with username so i can remove later --- server/model/monitor.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 140a9442c..c2b40b9bd 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -606,9 +606,9 @@ class Monitor extends BeanModel { if (result.toString() === this.expectedValue) { bean.msg += ", expected value is found"; bean.status = UP; - console.log('json-query successful') + console.log("neelbhanushali: json-query successful"); } else { - console.log('json-query unsuccessful') + console.log("neelbhanushali: json-query unsuccessful"); throw new Error(bean.msg + ", but value is not equal to expected value, value was: [" + result + "]"); } } @@ -900,7 +900,7 @@ class Monitor extends BeanModel { retries = 0; } catch (error) { - console.log('came in catch') + console.log("neelbhanushali: came in catch"); if (error?.name === "CanceledError") { bean.msg = `timeout by AbortSignal (${this.timeout}s)`; } else { @@ -915,7 +915,7 @@ class Monitor extends BeanModel { } else if ((this.maxretries > 0) && (retries < this.maxretries)) { retries++; bean.status = PENDING; - console.log('checking retries', retries, this.maxretries) + console.log("neelbhanushali: checking retries", retries, this.maxretries); } else { // Continue counting retries during DOWN retries++; @@ -974,7 +974,7 @@ class Monitor extends BeanModel { } else if (bean.status === MAINTENANCE) { log.warn("monitor", `Monitor #${this.id} '${this.name}': Under Maintenance | Type: ${this.type}`); } else { - beatInterval = this.retryInterval + beatInterval = this.retryInterval; log.warn("monitor", `Monitor #${this.id} '${this.name}': Failing: ${bean.msg} | Interval: ${beatInterval} seconds | Type: ${this.type} | Down Count: ${bean.downCount} | Resend Interval: ${this.resendInterval}`); } From 81e465f41896ab2369f554ba30d7f36ec672b5b2 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sun, 11 Feb 2024 20:02:09 +0100 Subject: [PATCH 4/4] Removed debug statement --- server/model/monitor.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index c2b40b9bd..2543cf1b3 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -606,9 +606,7 @@ class Monitor extends BeanModel { if (result.toString() === this.expectedValue) { bean.msg += ", expected value is found"; bean.status = UP; - console.log("neelbhanushali: json-query successful"); } else { - console.log("neelbhanushali: json-query unsuccessful"); throw new Error(bean.msg + ", but value is not equal to expected value, value was: [" + result + "]"); } } @@ -900,7 +898,6 @@ class Monitor extends BeanModel { retries = 0; } catch (error) { - console.log("neelbhanushali: came in catch"); if (error?.name === "CanceledError") { bean.msg = `timeout by AbortSignal (${this.timeout}s)`; } else { @@ -915,7 +912,6 @@ class Monitor extends BeanModel { } else if ((this.maxretries > 0) && (retries < this.maxretries)) { retries++; bean.status = PENDING; - console.log("neelbhanushali: checking retries", retries, this.maxretries); } else { // Continue counting retries during DOWN retries++;