Comparison

plugins/muc/mod_muc.lua @ 8925:d367aeb9c50f

MUC: Rename eviction hit rate measure
author Kim Alvefur <zash@zash.se>
date Sat, 23 Jun 2018 18:58:56 +0200
parent 8879:4dee8c439afc
child 8926:89f6b2a2bec3
comparison
equal deleted inserted replaced
8924:8fe98e365ab8 8925:d367aeb9c50f
133 end 133 end
134 134
135 local max_rooms = module:get_option_number("muc_max_rooms"); 135 local max_rooms = module:get_option_number("muc_max_rooms");
136 local max_live_rooms = module:get_option_number("muc_room_cache_size", 100); 136 local max_live_rooms = module:get_option_number("muc_room_cache_size", 100);
137 137
138 local eviction_hit_rate = module:measure("room_eviction", "rate"); 138 local room_eviction = module:measure("room_eviction", "rate");
139 local rooms = cache.new(max_rooms or max_live_rooms, function (jid, room) 139 local rooms = cache.new(max_rooms or max_live_rooms, function (jid, room)
140 if max_rooms then 140 if max_rooms then
141 module:log("info", "Room limit of %d reached, no new rooms allowed"); 141 module:log("info", "Room limit of %d reached, no new rooms allowed");
142 return false; 142 return false;
143 end 143 end
144 module:log("debug", "Evicting room %s", jid); 144 module:log("debug", "Evicting room %s", jid);
145 eviction_hit_rate(); 145 room_eviction();
146 room_items_cache[room.jid] = room:get_public() and room:get_name() or nil; 146 room_items_cache[room.jid] = room:get_public() and room:get_name() or nil;
147 local ok, err = room_save(room, nil, true); -- Force to disk 147 local ok, err = room_save(room, nil, true); -- Force to disk
148 if not ok then 148 if not ok then
149 module:log("error", "Failed to swap inactive room %s to disk: %s", jid, err); 149 module:log("error", "Failed to swap inactive room %s to disk: %s", jid, err);
150 return false; 150 return false;