Merge pull request #671 from bluewave-labs/fix/be/null-monitor-check

Add null monitor check to Network Service
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-08-19 19:07:07 -07:00
commit 97ef58534e
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) {