summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_msg_store_vhost_sup.erl13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/rabbit_msg_store_vhost_sup.erl b/src/rabbit_msg_store_vhost_sup.erl
index 3aef5e7428..d5ed915da4 100644
--- a/src/rabbit_msg_store_vhost_sup.erl
+++ b/src/rabbit_msg_store_vhost_sup.erl
@@ -29,10 +29,7 @@ start_store_for_vhost(Name, VhostsClientRefs, StartupFunState, VHost) ->
VHostDir = rabbit_vhost:msg_store_dir_path(VHost),
ok = rabbit_file:ensure_dir(VHostDir),
rabbit_log:info("Making sure message store directory '~s' for vhost '~s' exists~n", [VHostDir, VHost]),
- VhostRefs = case maps:find(VHost, VhostsClientRefs) of
- {ok, Refs} -> Refs;
- error -> []
- end,
+ VhostRefs = refs_for_vhost(VHost, VhostsClientRefs),
case rabbit_msg_store:start_link(Name, VHostDir, VhostRefs, StartupFunState) of
{ok, Pid} ->
ets:insert(Name, {VHost, Pid}),
@@ -43,6 +40,14 @@ start_store_for_vhost(Name, VhostsClientRefs, StartupFunState, VHost) ->
{error, {already_started, Pid}}
end.
+refs_for_vhost(_, undefined) -> undefined;
+refs_for_vhost(VHost, Refs) ->
+ case maps:find(VHost, Refs) of
+ {ok, Val} -> Val;
+ error -> []
+ end.
+
+
delete_vhost(Name, VHost) ->
case vhost_store_pid(Name, VHost) of
no_pid -> ok;