From a64c42c9d45ebc1f1237d78d99b8884ae9aa3c4e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 28 Mar 2021 13:22:35 +0200 Subject: MUC: Report number of live rooms to statsmanager Should help inform on whether the cache size should be increased. --- plugins/muc/mod_muc.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plugins/muc') diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua index bc44815e..04846359 100644 --- a/plugins/muc/mod_muc.lua +++ b/plugins/muc/mod_muc.lua @@ -182,6 +182,11 @@ local rooms = cache.new(max_rooms or max_live_rooms, function (jid, room) end end); +local measure_rooms_size = module:measure("live_room", "amount"); +module:hook_global("stats-update", function () + measure_rooms_size(rooms:count()); +end); + -- Automatically destroy empty non-persistent rooms module:hook("muc-occupant-left",function(event) local room = event.room -- cgit v1.2.3