Changeset

8656:0e84814a7ece

MUC: Produce an untracked, locked room on failure to read room from storage (#1091)
author Kim Alvefur <zash@zash.se>
date Mon, 12 Mar 2018 21:47:39 +0100
parents 8655:ba6a6a04b46c
children 8657:a804f2e75f10
files plugins/muc/mod_muc.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Thu Mar 22 16:26:09 2018 +0000
+++ b/plugins/muc/mod_muc.lua	Mon Mar 12 21:47:39 2018 +0100
@@ -148,13 +148,17 @@
 
 local function restore_room(jid)
 	local node = jid_split(jid);
-	local data = room_configs:get(node);
+	local data, err = room_configs:get(node);
 	local state = room_state:get(node);
 	if data then
 		module:log("debug", "Restoring room %s from storage", jid);
 		local room = muclib.restore_room(data, state);
 		track_room(room);
 		return room;
+	elseif err then
+		module:log("error", "Error restoring room %s from storage: %s", jid, err);
+		local room = muclib.new_room(jid, { locked = math.huge });
+		return room;
 	end
 end