From 63bc4d080f5160ceffcdf340f0e0edef662b59ef Mon Sep 17 00:00:00 2001 From: Julia Date: Tue, 4 Jun 2024 15:02:53 +0200 Subject: [PATCH] Fix update metrics --- engine/apps/alerts/tasks/notify_user.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/apps/alerts/tasks/notify_user.py b/engine/apps/alerts/tasks/notify_user.py index d035b1b887..d1481dae2a 100644 --- a/engine/apps/alerts/tasks/notify_user.py +++ b/engine/apps/alerts/tasks/notify_user.py @@ -254,9 +254,6 @@ def notify_user_task( notification_channel=notification_policy.notify_by, ) - if log_record: # log_record is None if user notification policy step is unspecified - log_record.save() - is_notification_triggered = ( log_record.type == UserNotificationPolicyLogRecord.TYPE_PERSONAL_NOTIFICATION_TRIGGERED if log_record @@ -273,6 +270,9 @@ def notify_user_task( ): update_metrics_for_user.apply_async((user.id,)) + if log_record: # log_record is None if user notification policy step is unspecified + log_record.save() + if not stop_escalation: # if the step is NOTIFY and notification was not not bundled, perform regular notification # and update time when user was notified