# HG changeset patch # User Kim Alvefur # Date 1454426781 -3600 # Node ID 464edd03099a029db5b3554f9e63652753469966 # Parent a85b5c3791dc4609634bcdc7f88e79a51d7f678b mod_mam: Add a bit of randomness to cleanup intervals to keep some time between multiple instances diff -r a85b5c3791dc -r 464edd03099a mod_mam/mod_mam.lua --- a/mod_mam/mod_mam.lua Tue Feb 02 16:22:46 2016 +0100 +++ b/mod_mam/mod_mam.lua Tue Feb 02 16:26:21 2016 +0100 @@ -298,7 +298,7 @@ end end); - module:add_timer(10, function() + module:add_timer(math.random(10, 60), function() local user = next(cleanup); if user then module:log("debug", "Removing old messages for user %q", user); @@ -308,7 +308,7 @@ end cleanup[user] = nil; end - return cleanup_interval; + return math.random(cleanup_interval, cleanup_interval * 2); end); end