Changeset

10683:2f0b7f1d5e75

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Wed, 11 Mar 2020 22:44:41 +0100
parents 10680:19692fc5c106 (current diff) 10682:62ef68f95b6f (diff)
children 10684:de607875d4bd
files net/server_epoll.lua plugins/mod_mam/mod_mam.lua plugins/mod_muc_mam.lua
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_mam/mod_mam.lua	Wed Mar 11 16:32:41 2020 +0000
+++ b/plugins/mod_mam/mod_mam.lua	Wed Mar 11 22:44:41 2020 +0100
@@ -403,7 +403,8 @@
 	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 @@
 				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();
--- a/plugins/mod_muc_mam.lua	Wed Mar 11 16:32:41 2020 +0000
+++ b/plugins/mod_muc_mam.lua	Wed Mar 11 22:44:41 2020 +0100
@@ -486,7 +486,8 @@
 
 	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 @@
 				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();