Fixes alerts starving in per-recipient queues

This commit is contained in:
Simone Mainardi 2020-09-02 14:52:40 +02:00
parent 6fb8393117
commit 28caa3ac33
6 changed files with 64 additions and 54 deletions

View file

@ -65,11 +65,10 @@ end
-- Dequeue alerts from a recipient queue for sending notifications
function syslog.dequeueRecipientAlerts(recipient, budget)
local notifications = ntop.lrangeCache(recipient.export_queue, 0, budget-1)
local notifications = ntop.lrangeCache(recipient.export_queue, 0, budget - 1)
if not notifications or #notifications == 0 then
return {success = true}
return {success = true, more_available = false}
end
-- Separate by severity and channel
@ -98,7 +97,7 @@ function syslog.dequeueRecipientAlerts(recipient, budget)
-- Remove the processed messages from the queue
ntop.ltrimCache(recipient.export_queue, #notifications, -1)
return {success = true}
return {success = true, more_available = true}
end
-- ##############################################