Add null monitor check to Network Service
This commit is contained in:
1 parent
b94d93e276
commit
bf336ce0a5
1 file changed
+8
@@ -16,6 +16,14 @@ class NetworkService {
|
|||||||
async handleNotification(job, isAlive) {
|
async handleNotification(job, isAlive) {
|
||||||
const { _id } = job.data;
|
const { _id } = job.data;
|
||||||
const monitor = await this.db.getMonitorById(_id);
|
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 changes, update monitor status and send notification
|
||||||
if (monitor.status !== isAlive) {
|
if (monitor.status !== isAlive) {
|
||||||
|
|||||||
Reference in new issue
Block a user