Skip to content

Commit 49eb0ff

Browse files
authored
Fix: [Push Monitor] Send notifications during maintenance period (#5847)
1 parent c67f6ef commit 49eb0ff

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/routers/api-router.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ router.all("/api/push/:pushToken", async (request, response) => {
5050
let msg = request.query.msg || "OK";
5151
let ping = parseFloat(request.query.ping) || null;
5252
let statusString = request.query.status || "up";
53-
let status = (statusString === "up") ? UP : DOWN;
53+
const statusFromParam = (statusString === "up") ? UP : DOWN;
5454

5555
let monitor = await R.findOne("monitor", " push_token = ? AND active = 1 ", [
5656
pushToken
@@ -80,7 +80,7 @@ router.all("/api/push/:pushToken", async (request, response) => {
8080
msg = "Monitor under maintenance";
8181
bean.status = MAINTENANCE;
8282
} else {
83-
determineStatus(status, previousHeartbeat, monitor.maxretries, monitor.isUpsideDown(), bean);
83+
determineStatus(statusFromParam, previousHeartbeat, monitor.maxretries, monitor.isUpsideDown(), bean);
8484
}
8585

8686
// Calculate uptime
@@ -92,9 +92,9 @@ router.all("/api/push/:pushToken", async (request, response) => {
9292
log.debug("router", "PreviousStatus: " + previousHeartbeat?.status);
9393
log.debug("router", "Current Status: " + bean.status);
9494

95-
bean.important = Monitor.isImportantBeat(isFirstBeat, previousHeartbeat?.status, status);
95+
bean.important = Monitor.isImportantBeat(isFirstBeat, previousHeartbeat?.status, bean.status);
9696

97-
if (Monitor.isImportantForNotification(isFirstBeat, previousHeartbeat?.status, status)) {
97+
if (Monitor.isImportantForNotification(isFirstBeat, previousHeartbeat?.status, bean.status)) {
9898
// Reset down count
9999
bean.downCount = 0;
100100

0 commit comments

Comments
 (0)