Add null monitor check to Network Service

This commit is contained in:
Alex Holliday committed 2024-08-19 09:48:45 -07:00
1 parent b94d93e276
commit bf336ce0a5
1 file changed
+8
+8
View File
@@ -16,6 +16,14 @@ class NetworkService {
async handleNotification(job, isAlive) {
const { _id } = job.data;
const monitor = await this.db.getMonitorById(_id);
if (monitor === null || monitor === undefined) {
logger.error(`Null Monitor: ${_id}`, {
method: "handleNotification",
service: this.SERVICE_NAME,
jobId: job.id,
});
return;
}
// If monitor status changes, update monitor status and send notification
if (monitor.status !== isAlive) {