Skip to content

Commit 81bcec4

Browse files
Merge pull request #11279 from rabbitmq/mk-start-virtual-host-on-an-arbitrary-set-of-nodes
Introduce rabbit_vhost_sup_sup:start_on_all_nodes/2
2 parents 22b16a1 + f22a027 commit 81bcec4

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

deps/rabbit/src/rabbit_vhost_sup_sup.erl

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
save_vhost_recovery_terms/2,
2323
lookup_vhost_sup_record/1,
2424
lookup_vhost_recovery_terms/1]).
25-
-export([delete_on_all_nodes/1, start_on_all_nodes/1]).
25+
-export([delete_on_all_nodes/1, start_on_all_nodes/1, start_on_all_nodes/2]).
2626
-export([is_vhost_alive/1]).
2727
-export([check/0]).
2828

@@ -54,16 +54,19 @@ init([]) ->
5454
[rabbit_vhost_sup_wrapper, rabbit_vhost_sup]}]}}.
5555

5656
start_on_all_nodes(VHost) ->
57-
%% Do not try to start a vhost on booting peer nodes
58-
AllBooted = [Node || Node <- rabbit_nodes:list_running()],
57+
%% By default select only fully booted peers
58+
AllBooted = rabbit_nodes:list_running(),
5959
Nodes = [node() | AllBooted],
60+
start_on_all_nodes(VHost, Nodes).
61+
62+
start_on_all_nodes(VHost, Nodes) ->
6063
Results = [{Node, start_vhost(VHost, Node)} || Node <- Nodes],
6164
Failures = lists:filter(fun
62-
({_, {ok, _}}) -> false;
63-
({_, {error, {already_started, _}}}) -> false;
64-
(_) -> true
65-
end,
66-
Results),
65+
({_, {ok, _}}) -> false;
66+
({_, {error, {already_started, _}}}) -> false;
67+
(_) -> true
68+
end,
69+
Results),
6770
case Failures of
6871
[] -> ok;
6972
Errors -> {error, {failed_to_start_vhost_on_nodes, Errors}}

0 commit comments

Comments
 (0)