Software /
code /
prosody
Comparison
plugins/muc/mod_muc.lua @ 7650:4c2407422f71
Logging error if MUC room cache is full
author | Sam Whited <sam@samwhited.com> |
---|---|
date | Fri, 02 Sep 2016 16:02:17 -0500 |
parent | 7641:5eef792bb2e1 |
child | 7694:bffbea1187ca |
comparison
equal
deleted
inserted
replaced
7649:c07f01869795 | 7650:4c2407422f71 |
---|---|
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 rooms = cache.new(module:get_option_number("muc_room_cache_size", 100), function (_, room) | 117 local rooms = cache.new(module:get_option_number("muc_room_cache_size", 100), function (jid, room) |
118 module:log("debug", "%s evicted", room); | 118 module:log("debug", "%s evicted", jid); |
119 room_save(room, nil, true); -- Force to disk | 119 room_save(room, nil, true); -- Force to disk |
120 end); | 120 end); |
121 | 121 |
122 -- Automatically destroy empty non-persistent rooms | 122 -- Automatically destroy empty non-persistent rooms |
123 module:hook("muc-occupant-left",function(event) | 123 module:hook("muc-occupant-left",function(event) |
149 rooms.save = nil; | 149 rooms.save = nil; |
150 rooms:set(room.jid, nil); | 150 rooms:set(room.jid, nil); |
151 end | 151 end |
152 | 152 |
153 function delete_room(room) | 153 function delete_room(room) |
154 module:log("debug", "Deleting %s", room); | 154 module:log("debug", "Deleting %s", room.jid); |
155 room_configs:set(jid_split(room.jid), nil); | 155 room_configs:set(jid_split(room.jid), nil); |
156 persistent_rooms:set(nil, room.jid, nil); | 156 persistent_rooms:set(nil, room.jid, nil); |
157 room_items_cache[room.jid] = nil; | 157 room_items_cache[room.jid] = nil; |
158 end | 158 end |
159 | 159 |