diff plugins/mod_mam/mod_mam.lua @ 14003:2c95239d0b92

mod_mam: Use util.async.sleep() helper (same functionality, less code) Well, not quite the same functionality. module:add_timer() would cancel the timer if the module got unloaded while processing. This would leave the async runner hanging forever. The new code would let it finish.
author Matthew Wild <mwild1@gmail.com>
date Sat, 06 Dec 2025 16:00:22 +0000
parents 9cfc62b4625b
children b6d857435de1
line wrap: on
line diff
--- a/plugins/mod_mam/mod_mam.lua	Sat Dec 06 15:58:40 2025 +0000
+++ b/plugins/mod_mam/mod_mam.lua	Sat Dec 06 16:00:22 2025 +0000
@@ -583,9 +583,7 @@
 				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();
+			async.sleep(0.1);
 		end
 		module:log("info", "Deleted %d expired messages for %d users", sum, num_users);
 		cleanup_done();