Review alert mitigation code

This commit is contained in:
Alfredo Cardigliano 2023-07-21 16:39:43 +02:00
parent 7b7e8a0e87
commit 392ce43159
2 changed files with 12 additions and 13 deletions

View file

@ -136,16 +136,15 @@ function telegram.dequeueRecipientAlerts(recipient, budget)
local notifications = {}
local i = 0
while i < max_alerts_per_request do
local notification = ntop.recipient_dequeue(recipient.recipient_id)
if notification then
if alert_utils.filter_notification(notification, recipient.recipient_id) then
local notification = ntop.recipient_dequeue(recipient.recipient_id)
if notification then
if alert_utils.filter_notification(notification, recipient.recipient_id) then
notifications[#notifications + 1] = notification.alert
i = i + 1
end
else
break
end
i = i + 1
end
else
break
end
end
if not notifications or #notifications == 0 then