comparison mod_limit_auth/mod_limit_auth.lua @ 1854:450ada5bb1b5

mod_limit_auth: Get rid of old inactive throttle objects
author Kim Alvefur <zash@zash.se>
date Mon, 14 Sep 2015 13:03:02 +0200
parents c1bb2a64aabb
children 2a5a44d5b935
comparison
equal deleted inserted replaced
1853:c25a0ac8b511 1854:450ada5bb1b5
44 44
45 module:hook("authentication-failure", function (event) 45 module:hook("authentication-failure", function (event)
46 get_throttle(event.session.ip):poll(1); 46 get_throttle(event.session.ip):poll(1);
47 end); 47 end);
48 48
49 -- TODO remove old throttles after some time 49 module:add_timer(14400, function (now)
50 local old = now - 86400;
51 for ip, throttle in pairs(throttles) do
52 if throttle.t < old then
53 throttles[ip] = nil;
54 end
55 end
56 end);
57