# HG changeset patch # User Kim Alvefur # Date 1442228582 -7200 # Node ID 450ada5bb1b5e3e9a88706877c257c77d5577037 # Parent c25a0ac8b511b19ebf86e52afab3cbf40d21676a mod_limit_auth: Get rid of old inactive throttle objects diff -r c25a0ac8b511 -r 450ada5bb1b5 mod_limit_auth/mod_limit_auth.lua --- a/mod_limit_auth/mod_limit_auth.lua Mon Sep 14 12:59:48 2015 +0200 +++ b/mod_limit_auth/mod_limit_auth.lua Mon Sep 14 13:03:02 2015 +0200 @@ -46,4 +46,12 @@ get_throttle(event.session.ip):poll(1); end); --- TODO remove old throttles after some time +module:add_timer(14400, function (now) + local old = now - 86400; + for ip, throttle in pairs(throttles) do + if throttle.t < old then + throttles[ip] = nil; + end + end +end); +