Diff

plugins/mod_muc_mam.lua @ 10683:2f0b7f1d5e75

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Wed, 11 Mar 2020 22:44:41 +0100
parent 10671:5e1384298e97
parent 10682:62ef68f95b6f
child 10800:62794e065e33
line wrap: on
line diff
--- 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();