aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-03-11 22:44:41 +0100
committerKim Alvefur <zash@zash.se>2020-03-11 22:44:41 +0100
commitd04da8fdd9c278f3e987af71208ea5865d11c54b (patch)
treef2fccefc282b9a052e61fc6a2f23306d95fb16d6 /plugins
parentcb6148d155ea02a68e40b8afb5861451750499ad (diff)
parente3911ce5da43b4d4c37fabebd7d3fe96435d7373 (diff)
downloadprosody-d04da8fdd9c278f3e987af71208ea5865d11c54b.tar.gz
prosody-d04da8fdd9c278f3e987af71208ea5865d11c54b.zip
Merge 0.11->trunk
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_mam/mod_mam.lua6
-rw-r--r--plugins/mod_muc_mam.lua6
2 files changed, 10 insertions, 2 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index b67635c9..8229eb4e 100644
--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -403,7 +403,8 @@ if cleanup_after ~= "never" then
end
local cleanup_time = module:measure("cleanup", "times");
- cleanup_runner = require "util.async".runner(function ()
+ local async = require "util.async";
+ cleanup_runner = async.runner(function ()
local cleanup_done = cleanup_time();
local users = {};
local cut_off = datestamp(os.time() - cleanup_after);
@@ -433,6 +434,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);
cleanup_done();
diff --git a/plugins/mod_muc_mam.lua b/plugins/mod_muc_mam.lua
index be345d79..7eeada6d 100644
--- a/plugins/mod_muc_mam.lua
+++ b/plugins/mod_muc_mam.lua
@@ -486,7 +486,8 @@ if cleanup_after ~= "never" then
local cleanup_time = module:measure("cleanup", "times");
- cleanup_runner = require "util.async".runner(function ()
+ local async = require "util.async";
+ cleanup_runner = async.runner(function ()
local cleanup_done = cleanup_time();
local rooms = {};
local cut_off = datestamp(os.time() - cleanup_after);
@@ -516,6 +517,9 @@ if cleanup_after ~= "never" then
cleanup_map:set(cut_off, room, true);
module:log("error", "Could not delete messages for room '%s': %s", room, err);
end
+ local wait, done = async.waiter();
+ module:add_timer(0.01, done);
+ wait();
end
module:log("info", "Deleted %d expired messages for %d rooms", sum, num_rooms);
cleanup_done();