[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot] 2026-01-15 19:23:25 +00:00 committed by GitHub
parent 645aecc3ba
commit f1cb00d876
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View File

@ -1538,7 +1538,10 @@ class Monitor extends BeanModel {
} catch (error) {
// If we can't calculate downtime, just continue without it
// Silently fail to avoid disrupting notification sending
log.debug("monitor", `[${monitor.name}] Could not calculate downtime information: ${error.message}`);
log.debug(
"monitor",
`[${monitor.name}] Could not calculate downtime information: ${error.message}`
);
}
}

View File

@ -121,16 +121,16 @@ class Discord extends NotificationProvider {
let wentOfflineFormatted = null;
if (heartbeatJSON["lastDownTime"]) {
const wentOfflineTimestamp = Math.floor(new Date(heartbeatJSON["lastDownTime"]).getTime() / 1000);
wentOfflineFormatted = `<t:${wentOfflineTimestamp}:F>`;
wentOfflineFormatted = `<t:${wentOfflineTimestamp}:F>`;
// Calculate the actual duration between went offline and back online
const durationSeconds = backOnlineTimestamp - wentOfflineTimestamp;
// Format duration as human-readable string (e.g., "1h 23m", "45m 30s")
const hours = Math.floor(durationSeconds / 3600);
const minutes = Math.floor((durationSeconds % 3600) / 60);
const seconds = durationSeconds % 60;
const durationParts = [];
if (hours > 0) {
durationParts.push(`${hours}h`);
@ -142,7 +142,7 @@ class Discord extends NotificationProvider {
// Only show seconds if less than an hour
durationParts.push(`${seconds}s`);
}
downtimeDuration = durationParts.length > 0 ? durationParts.join(" ") : "0s";
}