# HG changeset patch # User Kim Alvefur # Date 1637588945 -3600 # Node ID 871100cdbbad8eb8b30b7aa850415b4587de1e50 # Parent 18c0ca5fcbb8c5e97f9846e6889c003050a938f1 mod_muc_mam: Switch to mod_cron for message expiry diff -r 18c0ca5fcbb8 -r 871100cdbbad plugins/mod_muc_mam.lua --- a/plugins/mod_muc_mam.lua Sun Nov 21 18:16:03 2021 +0100 +++ b/plugins/mod_muc_mam.lua Mon Nov 22 14:49:05 2021 +0100 @@ -35,7 +35,6 @@ local default_max_items, max_max_items = 20, module:get_option_number("max_archive_query_results", 50); local cleanup_after = module:get_option_string("muc_log_expires_after", "1w"); -local cleanup_interval = module:get_option_number("muc_log_cleanup_interval", 4 * 60 * 60); local default_history_length = 20; local max_history_length = module:get_option_number("max_history_messages", math.huge); @@ -494,7 +493,7 @@ local cleanup_time = module:measure("cleanup", "times"); local async = require "util.async"; - cleanup_runner = async.runner(function () + module:daily("Remove expired messages", function () local cleanup_done = cleanup_time(); if archive.caps and archive.caps.wildcard_delete then @@ -550,10 +549,6 @@ cleanup_done(); end); - cleanup_task = module:add_timer(1, function () - cleanup_runner:run(true); - return cleanup_interval; - end); else module:log("debug", "Archive expiry disabled"); end