mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Prevents alerts starvation in the emails queue
This commit is contained in:
parent
23c45f3f4a
commit
dbb05fe6b6
2 changed files with 5 additions and 3 deletions
|
|
@ -6,8 +6,8 @@ local email = {}
|
|||
|
||||
email.EXPORT_FREQUENCY = 60
|
||||
|
||||
local MAX_ALERTS_PER_EMAIL = 20
|
||||
local MAX_NUM_SEND_ATTEMPTS = 3
|
||||
local MAX_ALERTS_PER_EMAIL = 100
|
||||
local MAX_NUM_SEND_ATTEMPTS = 5
|
||||
local NUM_ATTEMPTS_KEY = "ntopng.alerts.modules_notifications_queue.email.num_attemps"
|
||||
|
||||
local function buildMessageHeader(now_ts, from, to, subject, body)
|
||||
|
|
@ -88,6 +88,8 @@ function email.dequeueAlerts(queue)
|
|||
|
||||
if num_attemps >= MAX_NUM_SEND_ATTEMPTS then
|
||||
ntop.delCache(NUM_ATTEMPTS_KEY)
|
||||
-- Prevent alerts starvation if the plugin is not working after max num attempts
|
||||
ntop.delCache(queue)
|
||||
return {success=false, error_message="Unable to send mails"}
|
||||
else
|
||||
ntop.setCache(NUM_ATTEMPTS_KEY, tostring(num_attemps))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue