Skip to content

Commit

Permalink
[fix] Updated with changes #576
Browse files Browse the repository at this point in the history
Fixes #576
  • Loading branch information
praptisharma28 committed May 27, 2024
1 parent c31ab56 commit 38677d6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion openwisp_monitoring/device/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from django.core.cache import cache
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models.signals import post_delete
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
from django.utils.timezone import now
from django.utils.translation import gettext_lazy as _
Expand Down Expand Up @@ -469,6 +469,8 @@ def handle_critical_metric(cls, instance, **kwargs):
device_monitoring = cls.objects.get(device=instance.content_object)
if not instance.is_active or kwargs.get('signal') == post_delete:
device_monitoring.update_status('unknown')
elif kwargs.get('signal') == post_save and instance.is_active:
device_monitoring.update_status('ok')
except cls.DoesNotExist:
pass

Expand Down

0 comments on commit 38677d6

Please sign in to comment.