Changeset

10585:2d8535338099

mod_muc_mam: Measure how long a cleanup run takes (like mod_mam)
author Kim Alvefur <zash@zash.se>
date Sat, 04 Jan 2020 14:05:10 +0100
parents 10584:0c464bb7eb03
children 10586:f86ed818a7f8
files plugins/mod_muc_mam.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_muc_mam.lua	Thu Jan 02 13:17:43 2020 +0100
+++ b/plugins/mod_muc_mam.lua	Sat Jan 04 14:05:10 2020 +0100
@@ -481,7 +481,10 @@
 		end
 	end
 
+	local cleanup_time = module:measure("cleanup", "times");
+
 	cleanup_runner = require "util.async".runner(function ()
+		local cleanup_done = cleanup_time();
 		local rooms = {};
 		local cut_off = datestamp(os.time() - cleanup_after);
 		for date in cleanup_storage:users() do
@@ -512,6 +515,7 @@
 			end
 		end
 		module:log("info", "Deleted %d expired messages for %d rooms", sum, num_rooms);
+		cleanup_done();
 	end);
 
 	cleanup_task = module:add_timer(1, function ()