From a69091bb2875bfda3f057bbdd20c61b996d47c48 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Tue, 20 Jan 2026 19:49:40 +0000 Subject: [PATCH] replaced monitor with updatedMonitor --- .../SuperSimpleQueue/SuperSimpleQueueHelper.ts | 16 ++++++++++++---- .../notificationProviders/utils.ts | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/server/src/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.ts b/server/src/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.ts index 26d45db22..9a2957ee9 100644 --- a/server/src/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.ts +++ b/server/src/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.ts @@ -86,20 +86,28 @@ class SuperSimpleQueueHelper { // Step 5 handle notifications (best effort, continue even in event of failure, don't wait) this.notificationsService - .handleNotifications(monitor, status, statusChangeResult.prevStatus, statusChangeResult.statusChanged) + .handleNotifications(statusChangeResult.monitor, status, statusChangeResult.prevStatus, statusChangeResult.statusChanged) .catch((error: any) => { this.logger.error({ message: error.message, service: SERVICE_NAME, method: "getMonitorJob", - details: `Error sending notifications for job ${monitor.id}: ${error.message}`, + details: `Error sending notifications for job ${statusChangeResult.monitor.id}: ${error.message}`, stack: error.stack, }); }); - // Step 6. Handle incidents + // Step 6. Handle incidents (best effort, don't wait) if (statusChangeResult.statusChanged) { - await this.incidentService.handleIncident(statusChangeResult.monitor, statusChangeResult.code); + this.incidentService.handleIncident(statusChangeResult.monitor, statusChangeResult.code).catch((error: any) => { + this.logger.warn({ + message: error.message, + service: SERVICE_NAME, + method: "getMonitorJob", + details: `Error handling incident for job ${monitor.id}: ${error.message}`, + stack: error.stack, + }); + }); } } catch (error: any) { this.logger.warn({ diff --git a/server/src/service/infrastructure/notificationProviders/utils.ts b/server/src/service/infrastructure/notificationProviders/utils.ts index a7e954e55..f71933425 100644 --- a/server/src/service/infrastructure/notificationProviders/utils.ts +++ b/server/src/service/infrastructure/notificationProviders/utils.ts @@ -163,7 +163,7 @@ export const buildHardwareEmail = async (emailService: any, monitor: Monitor, al }; export const buildEmail = async (emailService: any, monitor: Monitor): Promise => { - const template = monitor.status === false ? "serverIsUpTemplate" : "serverIsDownTemplate"; + const template = monitor.status === true ? "serverIsUpTemplate" : "serverIsDownTemplate"; const context = { monitor: monitor.name, url: monitor.url }; const html = await emailService.buildEmail(template, context); return html;