# HG changeset patch # User Kim Alvefur # Date 1546763699 -3600 # Node ID 03ed7f10d8da868ac70c91c939af835dec7c598c # Parent 38f7bde4cfe07cac60b03950ca8694846add6564 mod_mam: Measure how long it takes to run the message expiry job job diff -r 38f7bde4cfe0 -r 03ed7f10d8da plugins/mod_mam/mod_mam.lua --- a/plugins/mod_mam/mod_mam.lua Fri Jan 04 15:13:52 2019 +0100 +++ b/plugins/mod_mam/mod_mam.lua Sun Jan 06 09:34:59 2019 +0100 @@ -351,8 +351,10 @@ function schedule_cleanup(username, date) cleanup_map:set(date or datestamp(), username, true); end + local cleanup_time = module:measure("cleanup", "times"); cleanup_runner = require "util.async".runner(function () + local cleanup_done = cleanup_time(); local users = {}; local cut_off = datestamp(os.time() - cleanup_after); for date in cleanup_storage:users() do @@ -376,6 +378,7 @@ end end module:log("info", "Deleted %d expired messages for %d users", sum, num_users); + cleanup_done(); end); cleanup_task = module:add_timer(1, function ()