Skip to content

Commit

Permalink
Merge pull request #1482 from rabbitmq/rabbitmq-server-vhost-sup-sup-…
Browse files Browse the repository at this point in the history
…badarg

Only call vhost status for fully started nodes
  • Loading branch information
michaelklishin authored Jan 25, 2018
2 parents 5b2c9be + 8a60207 commit 7429f0c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/rabbit_vhost_sup_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,13 @@ start_vhost(VHost, Node) ->
start_vhost(VHost) ->
case rabbit_vhost:exists(VHost) of
false -> {error, {no_such_vhost, VHost}};
true -> supervisor2:start_child(?MODULE, [VHost])
true ->
case whereis(?MODULE) of
Pid when is_pid(Pid) ->
supervisor2:start_child(?MODULE, [VHost]);
undefined ->
{error, rabbit_vhost_sup_sup_not_running}
end
end.

-spec is_vhost_alive(rabbit_types:vhost()) -> boolean().
Expand Down Expand Up @@ -221,9 +227,13 @@ save_vhost_process(VHost, VHostProcessPid) ->

-spec lookup_vhost_sup_record(rabbit_types:vhost()) -> #vhost_sup{} | not_found.
lookup_vhost_sup_record(VHost) ->
case ets:lookup(?MODULE, VHost) of
[] -> not_found;
[#vhost_sup{} = VHostSup] -> VHostSup
case ets:info(?MODULE, name) of
?MODULE ->
case ets:lookup(?MODULE, VHost) of
[] -> not_found;
[#vhost_sup{} = VHostSup] -> VHostSup
end;
undefined -> not_found
end.

-spec vhost_sup_pid(rabbit_types:vhost()) -> no_pid | {ok, pid()}.
Expand Down

0 comments on commit 7429f0c

Please sign in to comment.