diff --git a/server/model/monitor.js b/server/model/monitor.js index 661a7f5d4..c4890339c 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -1432,7 +1432,7 @@ class Monitor extends BeanModel { async checkSlowResponseNotification(monitor, bean) { //Get recent heartbeat list with range of time - const afterThisDate = new Date(Date.now() - (1000 * monitor.slowResponseNotificationRange)); + const afterThisDate = new Date(Date.now() - (1000 * (monitor.slowResponseNotificationRange + 1))); // add 1 second otherwise we grab 0 previous beats when Time Range == Heartbeat Interval const previousBeats = await R.getAll(` SELECT * FROM heartbeat WHERE monitor_id = ? AND time > datetime(?) AND status = ?`, diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index c68f8cde6..820c17a8c 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -458,7 +458,7 @@
- +
{{ $t("slowResponseNotificationRangeDescription", [monitor.slowResponseNotificationRange]) }}
@@ -1198,6 +1198,14 @@ message HealthCheckResponse { if (this.monitor.retryInterval === oldValue) { this.monitor.retryInterval = value; } + // Link interval and slowResponseNotificationRange if the are the same value + if (this.monitor.slowResponseNotificationRange === oldValue) { + this.monitor.slowResponseNotificationRange = value; + } + // But always keep slowResponseNotificationRange >= interval + if (this.monitor.slowResponseNotificationRange < value) { + this.monitor.slowResponseNotificationRange = value; + } }, "monitor.timeout"(value, oldValue) {