From 98ee9caf2cdc54a2f5edb864906d620e84196317 Mon Sep 17 00:00:00 2001 From: OidaTiftla Date: Thu, 5 May 2022 15:55:33 +0200 Subject: [PATCH] Add variable for currentTime Co-authored-by: Adam Stachowicz --- server/model/monitor.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 15181af67..f29f6de5e 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -492,11 +492,12 @@ class Monitor extends BeanModel { let timeSinceLastNotified = (dayjs.utc().valueOf() - (bean.lastNotifiedTime == null ? 0 : dayjs.utc(bean.lastNotifiedTime).valueOf())) / 1000 / 60; if (timeSinceLastNotified >= this.resendInterval) { // Send notification again, because we are still DOWN - log.debug("monitor", `[${this.name}] sendNotification again: lastNotifiedTime: ${bean.lastNotifiedTime} | current time: ${R.isoDateTime(dayjs.utc())}`); + const currentTime = R.isoDateTime(dayjs.utc()); + log.debug("monitor", `[${this.name}] sendNotification again: lastNotifiedTime: ${bean.lastNotifiedTime} | current time: ${currentTime}`); await Monitor.sendNotification(isFirstBeat, this, bean); // Set last notified time to now - bean.lastNotifiedTime = R.isoDateTime(dayjs.utc()); + bean.lastNotifiedTime = currentTime; } } }