# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1616930555 -7200
# Node ID 6da8d9cb355d01d4a89df613e787f1122c8601a7
# Parent  c3fb802f9e4584db76468ba1caf39aad8f3f3ba9
MUC: Report number of live rooms to statsmanager

Should help inform on whether the cache size should be increased.

diff -r c3fb802f9e45 -r 6da8d9cb355d plugins/muc/mod_muc.lua
--- a/plugins/muc/mod_muc.lua	Sun Mar 28 13:15:11 2021 +0200
+++ b/plugins/muc/mod_muc.lua	Sun Mar 28 13:22:35 2021 +0200
@@ -182,6 +182,11 @@
 	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