# HG changeset patch # User Matthew Wild # Date 1765036822 0 # Node ID 2c95239d0b92aea8dd12f42d6385807fa4a6235e # Parent f82be93b61a51410eb7c3939686c687a0cd6d012 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. diff -r f82be93b61a5 -r 2c95239d0b92 plugins/mod_mam/mod_mam.lua --- 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();