From 2ad3f748f90f5b7310d1a1ff742d8d58a37faca8 Mon Sep 17 00:00:00 2001 From: zhangwei Date: Sat, 17 May 2025 12:13:43 +0800 Subject: [PATCH] Fix monitor reference in push notification logic --- 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;