Software /
code /
prosody
Comparison
plugins/muc/mod_muc.lua @ 8386:9d5eb384daa8
MUC: Measure rate of room eviction
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 09 Nov 2017 17:27:37 +0100 |
parent | 8385:43d50a957463 |
child | 8387:7d61431e1aa6 |
comparison
equal
deleted
inserted
replaced
8385:43d50a957463 | 8386:9d5eb384daa8 |
---|---|
112 room_state:set(node, nil); | 112 room_state:set(node, nil); |
113 return room_configs:set(node, nil); | 113 return room_configs:set(node, nil); |
114 end | 114 end |
115 end | 115 end |
116 | 116 |
117 local eviction_hit_rate = module:measure("room_eviction", "rate"); | |
117 local rooms = cache.new(module:get_option_number("muc_room_cache_size", 100), function (jid, room) | 118 local rooms = cache.new(module:get_option_number("muc_room_cache_size", 100), function (jid, room) |
118 module:log("debug", "Evicting room %s", jid); | 119 module:log("debug", "Evicting room %s", jid); |
120 eviction_hit_rate(); | |
119 room_save(room, nil, true); -- Force to disk | 121 room_save(room, nil, true); -- Force to disk |
120 end); | 122 end); |
121 | 123 |
122 -- Automatically destroy empty non-persistent rooms | 124 -- Automatically destroy empty non-persistent rooms |
123 module:hook("muc-occupant-left",function(event) | 125 module:hook("muc-occupant-left",function(event) |