aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_mam/mod_mam.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mod_mam/mod_mam.lua')
-rw-r--r--plugins/mod_mam/mod_mam.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index 295d90e1..e7d89a95 100644
--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -362,7 +362,8 @@ if cleanup_after ~= "never" then
end
end
- cleanup_runner = require "util.async".runner(function ()
+ local async = require "util.async";
+ cleanup_runner = async.runner(function ()
local users = {};
local cut_off = datestamp(os.time() - cleanup_after);
for date in cleanup_storage:users() do
@@ -391,6 +392,9 @@ if cleanup_after ~= "never" then
cleanup_map:set(cut_off, user, true);
module:log("error", "Could not delete messages for user '%s': %s", user, err);
end
+ local wait, done = async.waiter();
+ module:add_timer(0.01, done);
+ wait();
end
module:log("info", "Deleted %d expired messages for %d users", sum, num_users);
end);