From 00de974528045070abb5a0a45424bd00563cc868 Mon Sep 17 00:00:00 2001 From: karenvicent Date: Mon, 15 Sep 2025 12:28:37 -0400 Subject: [PATCH] Fix: Skip notifications for monitors during active maintenance windows --- .../SuperSimpleQueue/SuperSimpleQueueHelper.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/src/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.js b/server/src/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.js index ac8da9169..b348e2534 100644 --- a/server/src/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.js +++ b/server/src/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.js @@ -28,11 +28,12 @@ class SuperSimpleQueueHelper { return async (monitor) => { try { const monitorId = monitor._id; + const teamId = monitor.teamId; if (!monitorId) { throw new Error("No monitor id"); } - const maintenanceWindowActive = await this.isInMaintenanceWindow(monitorId); + const maintenanceWindowActive = await this.isInMaintenanceWindow(monitorId, teamId); if (maintenanceWindowActive) { this.logger.info({ message: `Monitor ${monitorId} is in maintenance window`, @@ -77,8 +78,11 @@ class SuperSimpleQueueHelper { }; }; - async isInMaintenanceWindow(monitorId) { - const maintenanceWindows = await this.db.maintenanceWindowModule.getMaintenanceWindowsByMonitorId(monitorId); + async isInMaintenanceWindow(monitorId, teamId) { + const maintenanceWindows = await this.db.maintenanceWindowModule.getMaintenanceWindowsByMonitorId({ + monitorId: monitorId.toString(), + teamId: teamId.toString(), + }); // Check for active maintenance window: const maintenanceWindowIsActive = maintenanceWindows.reduce((acc, window) => { if (window.active) {