mod_mam: Add a bit of randomness to cleanup intervals to keep some time between multiple instances
--- 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