Recipient budget is no longer staticly assigned but a portion of the total budget

equally shared among the configured recipients with a cap of 1000
This commit is contained in:
Luca 2020-12-14 14:40:47 +01:00
parent e1158fb855
commit 48641b2e81
2 changed files with 7 additions and 2 deletions

View file

@ -670,8 +670,13 @@ local function process_notifications_by_priority(ready_recipients, high_priority
-- To avoid having one recipient jeopardizing all the resources, the total
-- budget is consumed in chunks, that is, recipients are iterated multiple times
-- and, each time any recipient has a maximum budget for every iteration.
local budget_per_iter = 10
local budget_per_iter = total_budget / #ready_recipients
-- Put a cap of 1000 messages/iteration
if(budget_per_iter > 1000) then
budget_per_iter = 1000
end
-- Cycle until there are ready_recipients and total_budget left
local cur_time = os.time()
while #ready_recipients > 0 and total_budget >= 0 and cur_time <= deadline and not ntop.isDeadlineApproaching() do