mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-20 11:15:19 +08:00
Fix: [Push Monitor] Send notifications during maintenance period (#5847)
This commit is contained in:
@@ -50,7 +50,7 @@ router.all("/api/push/:pushToken", async (request, response) => {
|
||||
let msg = request.query.msg || "OK";
|
||||
let ping = parseFloat(request.query.ping) || null;
|
||||
let statusString = request.query.status || "up";
|
||||
let status = (statusString === "up") ? UP : DOWN;
|
||||
const statusFromParam = (statusString === "up") ? UP : DOWN;
|
||||
|
||||
let monitor = await R.findOne("monitor", " push_token = ? AND active = 1 ", [
|
||||
pushToken
|
||||
@@ -80,7 +80,7 @@ router.all("/api/push/:pushToken", async (request, response) => {
|
||||
msg = "Monitor under maintenance";
|
||||
bean.status = MAINTENANCE;
|
||||
} else {
|
||||
determineStatus(status, previousHeartbeat, monitor.maxretries, monitor.isUpsideDown(), bean);
|
||||
determineStatus(statusFromParam, previousHeartbeat, monitor.maxretries, monitor.isUpsideDown(), bean);
|
||||
}
|
||||
|
||||
// Calculate uptime
|
||||
@@ -92,9 +92,9 @@ router.all("/api/push/:pushToken", async (request, response) => {
|
||||
log.debug("router", "PreviousStatus: " + previousHeartbeat?.status);
|
||||
log.debug("router", "Current Status: " + bean.status);
|
||||
|
||||
bean.important = Monitor.isImportantBeat(isFirstBeat, previousHeartbeat?.status, status);
|
||||
bean.important = Monitor.isImportantBeat(isFirstBeat, previousHeartbeat?.status, bean.status);
|
||||
|
||||
if (Monitor.isImportantForNotification(isFirstBeat, previousHeartbeat?.status, status)) {
|
||||
if (Monitor.isImportantForNotification(isFirstBeat, previousHeartbeat?.status, bean.status)) {
|
||||
// Reset down count
|
||||
bean.downCount = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user