From 0b29fd49adf74dd8680b1fe531633c98e8706eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=C4=83ng=20Khoa?= <63006945+etnad17@users.noreply.github.com> Date: Sun, 18 May 2025 04:33:00 +0700 Subject: [PATCH 1/2] =?UTF-8?q?fix(sql):=20use=20UTC=5FTIMESTAMP=20instead?= =?UTF-8?q?=20of=20NOW=20for=20consistent=20time=20calcul=E2=80=A6=20(#584?= =?UTF-8?q?3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/database.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/database.js b/server/database.js index 0e6a7405d..582f19c29 100644 --- a/server/database.js +++ b/server/database.js @@ -736,7 +736,7 @@ class Database { if (Database.dbConfig.type === "sqlite") { return "DATETIME('now', ? || ' hours')"; } else { - return "DATE_ADD(NOW(), INTERVAL ? HOUR)"; + return "DATE_ADD(UTC_TIMESTAMP(), INTERVAL ? HOUR)"; } } From 289e824a5dee792050bf2e87396e514cfde213f7 Mon Sep 17 00:00:00 2001 From: zhang-wei Date: Sun, 18 May 2025 06:05:48 +0800 Subject: [PATCH 2/2] Fix monitor reference in push notification logic (#5842) Co-authored-by: Frank Elsinga --- server/routers/api-router.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/routers/api-router.js b/server/routers/api-router.js index ed6db2cd1..3568f2abf 100644 --- a/server/routers/api-router.js +++ b/server/routers/api-router.js @@ -98,15 +98,15 @@ router.all("/api/push/:pushToken", async (request, response) => { // Reset down count bean.downCount = 0; - log.debug("monitor", `[${this.name}] sendNotification`); + log.debug("monitor", `[${monitor.name}] sendNotification`); await Monitor.sendNotification(isFirstBeat, monitor, bean); } else { - if (bean.status === DOWN && this.resendInterval > 0) { + if (bean.status === DOWN && monitor.resendInterval > 0) { ++bean.downCount; - if (bean.downCount >= this.resendInterval) { + if (bean.downCount >= monitor.resendInterval) { // Send notification again, because we are still DOWN - log.debug("monitor", `[${this.name}] sendNotification again: Down Count: ${bean.downCount} | Resend Interval: ${this.resendInterval}`); - await Monitor.sendNotification(isFirstBeat, this, bean); + log.debug("monitor", `[${monitor.name}] sendNotification again: Down Count: ${bean.downCount} | Resend Interval: ${monitor.resendInterval}`); + await Monitor.sendNotification(isFirstBeat, monitor, bean); // Reset down count bean.downCount = 0;