replaced monitor with updatedMonitor
This commit is contained in:
1 parent
c1b2bda623
commit
a69091bb28
2 files changed
+13
-5
No files matched your search
@@ -86,20 +86,28 @@ class SuperSimpleQueueHelper {
|
|||||||
|
|
||||||
// Step 5 handle notifications (best effort, continue even in event of failure, don't wait)
|
// Step 5 handle notifications (best effort, continue even in event of failure, don't wait)
|
||||||
this.notificationsService
|
this.notificationsService
|
||||||
.handleNotifications(monitor, status, statusChangeResult.prevStatus, statusChangeResult.statusChanged)
|
.handleNotifications(statusChangeResult.monitor, status, statusChangeResult.prevStatus, statusChangeResult.statusChanged)
|
||||||
.catch((error: any) => {
|
.catch((error: any) => {
|
||||||
this.logger.error({
|
this.logger.error({
|
||||||
message: error.message,
|
message: error.message,
|
||||||
service: SERVICE_NAME,
|
service: SERVICE_NAME,
|
||||||
method: "getMonitorJob",
|
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,
|
stack: error.stack,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Step 6. Handle incidents
|
// Step 6. Handle incidents (best effort, don't wait)
|
||||||
if (statusChangeResult.statusChanged) {
|
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) {
|
} catch (error: any) {
|
||||||
this.logger.warn({
|
this.logger.warn({
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ export const buildHardwareEmail = async (emailService: any, monitor: Monitor, al
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const buildEmail = async (emailService: any, monitor: Monitor): Promise<string> => {
|
export const buildEmail = async (emailService: any, monitor: Monitor): Promise<string> => {
|
||||||
const template = monitor.status === false ? "serverIsUpTemplate" : "serverIsDownTemplate";
|
const template = monitor.status === true ? "serverIsUpTemplate" : "serverIsDownTemplate";
|
||||||
const context = { monitor: monitor.name, url: monitor.url };
|
const context = { monitor: monitor.name, url: monitor.url };
|
||||||
const html = await emailService.buildEmail(template, context);
|
const html = await emailService.buildEmail(template, context);
|
||||||
return html;
|
return html;
|
||||||
|
|||||||
Reference in new issue
Block a user