1
0
mirror of https://github.com/tormachris/cf-workers-status-page.git synced 2024-11-23 14:45:41 +01:00

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.
This commit is contained in:
Chris Buckley 2021-11-17 11:17:12 +00:00 committed by Adam Janiš
parent 1189e708da
commit 596d30389f

View File

@ -141,8 +141,8 @@ export async function processCronTrigger(event) {
// Save allOperational to false
monitorsState.lastUpdate.allOperational = false
// Increment failed checks, only on status change (maybe call it .incidents instead?)
if (monitorStatusChanged) {
// Increment failed checks on status change or first fail of the day (maybe call it .incidents instead?)
if (monitorStatusChanged || monitorsState.monitors[monitor.id].checks[checkDay].fails == 0) {
monitorsState.monitors[monitor.id].checks[checkDay].fails++
}
}