mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-03-04 16:35:57 +00:00
Prevent slowResponseNotificationRange from being less than one Heartbeat Interval
This commit is contained in:
parent
c722d8b8a6
commit
fd745d1dcc
2 changed files with 10 additions and 2 deletions
|
@ -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 = ?`,
|
||||
|
|
|
@ -458,7 +458,7 @@
|
|||
|
||||
<div v-if="monitor.slowResponseNotification" class="my-3">
|
||||
<label for="slow-response-notification-range" class="form-label">{{ $t("slowResponseNotificationRange") }}</label>
|
||||
<input id="slow-response-notification-range" v-model="monitor.slowResponseNotificationRange" type="number" class="form-control" required min="0" step="1">
|
||||
<input id="slow-response-notification-range" v-model="monitor.slowResponseNotificationRange" type="number" class="form-control" required :min="monitor.interval" step="1">
|
||||
<div class="form-text">
|
||||
{{ $t("slowResponseNotificationRangeDescription", [monitor.slowResponseNotificationRange]) }}
|
||||
</div>
|
||||
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue