Fix recipients. (#6240)

This commit is contained in:
Nicolo Maio 2023-07-21 14:10:21 +00:00
parent 798a41594e
commit 7b7e8a0e87
8 changed files with 57 additions and 42 deletions

View file

@ -177,17 +177,19 @@ function syslog.dequeueRecipientAlerts(recipient, budget)
local settings = readSettings(recipient)
local notifications = {}
for i = 1, budget do
local notification = ntop.recipient_dequeue(recipient.recipient_id)
if notification then
local i = 0
while i < budget do
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
notifications[#notifications + 1] = notification.alert
i = i + 1
end
else
break
end
end
else
break
end
end
if not notifications or #notifications == 0 then
return {success = true, more_available = false}