Skip to content

Commit 596d303

Browse files
cmbuckleyeidam
authored andcommitted
Increment failed checks at least once
Currently, a failure is only recorded if a monitor transitions from operational to not in a given day. If the monitor is non-operational at the start of the day, or remains non-operational for a full day, the failure will not be recorded.
1 parent 1189e70 commit 596d303

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/functions/cronTrigger.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ export async function processCronTrigger(event) {
141141
// Save allOperational to false
142142
monitorsState.lastUpdate.allOperational = false
143143

144-
// Increment failed checks, only on status change (maybe call it .incidents instead?)
145-
if (monitorStatusChanged) {
144+
// Increment failed checks on status change or first fail of the day (maybe call it .incidents instead?)
145+
if (monitorStatusChanged || monitorsState.monitors[monitor.id].checks[checkDay].fails == 0) {
146146
monitorsState.monitors[monitor.id].checks[checkDay].fails++
147147
}
148148
}

0 commit comments

Comments
 (0)