Software /
code /
prosody
Changeset
8662:a4e63b037a2a
MUC: Catch and log error in case of storage failure in iterator over rooms
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 15 Mar 2018 06:19:57 +0100 |
parents | 8661:7fc0784491ef |
children | 8663:a7a9d9511dc1 |
files | plugins/muc/mod_muc.lua |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua Thu Mar 22 20:08:32 2018 +0100 +++ b/plugins/muc/mod_muc.lua Thu Mar 15 06:19:57 2018 +0100 @@ -230,7 +230,15 @@ 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