From 01b57242244fc3d179a5dd94104cbb2bca8637cc Mon Sep 17 00:00:00 2001 From: "oleksandr.shostak@consultic.com" Date: Wed, 14 Jan 2026 10:11:56 +0200 Subject: [PATCH] Allow disabling recovery interval --- server/model/monitor.js | 16 ++++++++++------ src/lang/en.json | 2 ++ src/pages/EditMonitor.vue | 22 +++++++++++++++------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 0e8c9d29d..f95b906ea 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -1083,9 +1083,10 @@ class Monitor extends BeanModel { if (this.downRetryInterval > 0) { beatInterval = this.downRetryInterval; } + const intervalNote = this.downRetryInterval > 0 ? " (recovery)" : ""; 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}` + `Monitor #${this.id} '${this.name}': Failing: ${bean.msg} | Interval: ${beatInterval} seconds${intervalNote} | Type: ${this.type} | Down Count: ${bean.downCount} | Resend Interval: ${this.resendInterval}` ); } @@ -1710,11 +1711,14 @@ class Monitor extends BeanModel { throw new Error(`Retry interval cannot be less than ${MIN_INTERVAL_SECOND} seconds`); } - if (this.downRetryInterval > MAX_INTERVAL_SECOND) { - throw new Error(`Down retry interval cannot be more than ${MAX_INTERVAL_SECOND} seconds`); - } - if (this.downRetryInterval < MIN_INTERVAL_SECOND) { - throw new Error(`Down retry interval cannot be less than ${MIN_INTERVAL_SECOND} seconds`); + const downRetryInterval = Number(this.downRetryInterval); + if (downRetryInterval !== 0) { + if (downRetryInterval > MAX_INTERVAL_SECOND) { + throw new Error(`Down retry interval cannot be more than ${MAX_INTERVAL_SECOND} seconds`); + } + if (downRetryInterval < MIN_INTERVAL_SECOND) { + throw new Error(`Down retry interval cannot be less than ${MIN_INTERVAL_SECOND} seconds`); + } } if (this.response_max_length !== undefined) { diff --git a/src/lang/en.json b/src/lang/en.json index f4f075786..97de6e1fe 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -85,6 +85,8 @@ "checkEverySecond": "Check every {0} seconds", "retryCheckEverySecond": "Retry every {0} seconds", "downCheckEverySecond": "Check every {0} seconds while down", + "downRetryIntervalDisabled": "Use heartbeat interval when down", + "downRetryIntervalDescription": "Set to 0 to use the heartbeat interval while the monitor is down.", "resendEveryXTimes": "Resend every {0} times", "resendDisabled": "Resend disabled", "retriesDescription": "Maximum retries before the service is marked as down and a notification is sent", diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index fd0b43468..530616d2b 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -1188,7 +1188,10 @@
-
+
+ {{ $t("downRetryIntervalDescription") }} +
+
{{ $t("minimumIntervalWarning") }}
@@ -2277,7 +2283,7 @@ const monitorDefaults = { interval: 60, humanReadableInterval: timeDurationFormatter.secondsToHumanReadableFormat(60), retryInterval: 60, - downRetryInterval: 60, + downRetryInterval: 0, resendInterval: 0, maxretries: 0, retryOnlyOnStatusCodeFailure: false, @@ -2927,8 +2933,8 @@ message HealthCheckResponse { if (this.monitor.retryInterval === 0) { this.monitor.retryInterval = this.monitor.interval; } - if (!this.monitor.downRetryInterval) { - this.monitor.downRetryInterval = this.monitor.interval; + if (this.monitor.downRetryInterval === undefined || this.monitor.downRetryInterval === null) { + this.monitor.downRetryInterval = 0; } // Handling for monitors that are missing/zeroed timeout if (!this.monitor.timeout) { @@ -3108,7 +3114,9 @@ message HealthCheckResponse { // do this if the interval value has changed since last save. if ( this.lowIntervalConfirmation.editedValue && - (this.monitor.interval < 20 || this.monitor.retryInterval < 20 || this.monitor.downRetryInterval < 20) && + (this.monitor.interval < 20 || + this.monitor.retryInterval < 20 || + (this.monitor.downRetryInterval > 0 && this.monitor.downRetryInterval < 20)) && !this.lowIntervalConfirmation.confirmed ) { // The dialog will then re-call submit