Skip to content

Commit

Permalink
Merge pull request snabbco#940 from Igalia/ingress-drop-monitor-fix
Browse files Browse the repository at this point in the history
Ingress drop timer doesn't count drops in the 10 seconds after a flush
  • Loading branch information
wingo authored Sep 14, 2017
2 parents 10c5b30 + fa9f31a commit 33d451e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/timers/ingress_drop_monitor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ local IngressDropMonitor = {}
function new(args)
local ret = {
threshold = args.threshold or 100000,
wait = args.wait or 20,
wait = args.wait or 30,
grace_period = args.grace_period or 10,
action = args.action or 'flush',
tips_url = args.tips_url or default_tips_url,
last_flush = 0,
Expand Down Expand Up @@ -56,6 +57,10 @@ function IngressDropMonitor:sample ()
end

function IngressDropMonitor:jit_flush_if_needed ()
if now() - self.last_flush < self.grace_period then
self.last_value[0] = self.current_value[0]
return
end
if self.current_value[0] - self.last_value[0] < self.threshold then return end
if now() - self.last_flush < self.wait then return end
self.last_flush = now()
Expand Down

0 comments on commit 33d451e

Please sign in to comment.