Comparison

plugins/muc/mod_muc.lua @ 8387:7d61431e1aa6

MUC: Cache names of public rooms on eviction
author Kim Alvefur <zash@zash.se>
date Thu, 09 Nov 2017 17:27:52 +0100
parent 8386:9d5eb384daa8
child 8572:ce1737520943
comparison
equal deleted inserted replaced
8386:9d5eb384daa8 8387:7d61431e1aa6
116 116
117 local eviction_hit_rate = module:measure("room_eviction", "rate"); 117 local eviction_hit_rate = module:measure("room_eviction", "rate");
118 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)
119 module:log("debug", "Evicting room %s", jid); 119 module:log("debug", "Evicting room %s", jid);
120 eviction_hit_rate(); 120 eviction_hit_rate();
121 room_items_cache[room.jid] = room:get_public() and room:get_name() or nil;
121 room_save(room, nil, true); -- Force to disk 122 room_save(room, nil, true); -- Force to disk
122 end); 123 end);
123 124
124 -- Automatically destroy empty non-persistent rooms 125 -- Automatically destroy empty non-persistent rooms
125 module:hook("muc-occupant-left",function(event) 126 module:hook("muc-occupant-left",function(event)