aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-03-28 13:22:35 +0200
committerKim Alvefur <zash@zash.se>2021-03-28 13:22:35 +0200
commita64c42c9d45ebc1f1237d78d99b8884ae9aa3c4e (patch)
treeb9498479617caff7918e3f9f0eac82e97b15f3cf
parent9631d45fcc26b772b86ddf756608dd7ac2cf4a57 (diff)
downloadprosody-a64c42c9d45ebc1f1237d78d99b8884ae9aa3c4e.tar.gz
prosody-a64c42c9d45ebc1f1237d78d99b8884ae9aa3c4e.zip
MUC: Report number of live rooms to statsmanager
Should help inform on whether the cache size should be increased.
-rw-r--r--plugins/muc/mod_muc.lua5
1 files changed, 5 insertions, 0 deletions
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