diff options
author | Kim Alvefur <zash@zash.se> | 2018-03-15 06:19:57 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-03-15 06:19:57 +0100 |
commit | 9589a0588ebc9da60dff749ab245f4e6484d6036 (patch) | |
tree | 5d3d8863c12abdfbdda637659991187083bc6aca /plugins/muc | |
parent | 65cbf15f6b3904841918c2e787000cb61b89f068 (diff) | |
download | prosody-9589a0588ebc9da60dff749ab245f4e6484d6036.tar.gz prosody-9589a0588ebc9da60dff749ab245f4e6484d6036.zip |
MUC: Catch and log error in case of storage failure in iterator over rooms
Diffstat (limited to 'plugins/muc')
-rw-r--r-- | plugins/muc/mod_muc.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua index d9d8fa2e..979aed8c 100644 --- a/plugins/muc/mod_muc.lua +++ b/plugins/muc/mod_muc.lua @@ -230,7 +230,15 @@ function each_room(local_only) coroutine.yield(room); seen[room.jid] = true; end - for room_jid in pairs(persistent_rooms_storage:get(nil) or {}) do + local all_persistent_rooms, err = persistent_rooms_storage:get(nil); + if not all_persistent_rooms then + if err then + module:log("error", "Error loading list of persistent rooms, only rooms live in memory were iterated over"); + module:log("debug", "%s", debug.traceback(err)); + end + return nil; + end + for room_jid in pairs(all_persistent_rooms) do if not seen[room_jid] then local room = restore_room(room_jid); if room then |