Diff

plugins/muc/mod_muc.lua @ 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
parent 8572:ce1737520943
child 8657:a804f2e75f10
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