From cf33f5a2f6bb9ff468927e76abcc7ee5b96a3e93 Mon Sep 17 00:00:00 2001 From: Raj Nandan Sharma Date: Tue, 29 Apr 2025 21:20:04 +0530 Subject: [PATCH] refactor: improve downtime duration calculation in closure comment #387 --- src/lib/server/alerting.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/server/alerting.js b/src/lib/server/alerting.js index adb5841..fba604d 100644 --- a/src/lib/server/alerting.js +++ b/src/lib/server/alerting.js @@ -104,7 +104,7 @@ async function closeIncident(alert, comment) { function createClosureComment(alert, commonJSON) { let comment = "The incident has been auto resolved"; - let downtimeDuration = moment(alert.updated_at).diff(moment(alert.created_at), "minutes"); + let downtimeDuration = Math.round(moment(alert.updated_at).diff(moment(alert.created_at), "seconds") / 60); comment = comment + `, Total downtime: ` + downtimeDuration + ` minutes`; return comment; }