Skip to content

Commit baef781

Browse files
author
Daniil Fedotov
committed
Configurable vhost restart strategy
1 parent 5c0cf89 commit baef781

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/rabbit_vhost_sup_sup.erl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,23 @@
3333
-record(vhost_sup, {vhost, vhost_sup_pid, wrapper_pid}).
3434

3535
start() ->
36-
rabbit_sup:start_supervisor_child(?MODULE).
36+
supervisor:start_child(rabbit_sup,
37+
{?MODULE, {?MODULE, start_link, []},
38+
permanent, infinity, supervisor, [?MODULE]}).
3739

3840
start_link() ->
3941
supervisor2:start_link({local, ?MODULE}, ?MODULE, []).
4042

4143
init([]) ->
44+
VhostRestart = case application:get_env(rabbit, vhost_restart_strategy, stop_rabbit) of
45+
give_up -> transient;
46+
stop_rabbit -> permanent
47+
end,
48+
4249
ets:new(?MODULE, [named_table, public, {keypos, #vhost_sup.vhost}]),
4350
{ok, {{simple_one_for_one, 0, 5},
4451
[{rabbit_vhost, {rabbit_vhost_sup_wrapper, start_link, []},
45-
permanent, infinity, supervisor,
52+
VhostRestart, infinity, supervisor,
4653
[rabbit_vhost_sup_wrapper, rabbit_vhost_sup]}]}}.
4754

4855
start_on_all_nodes(VHost) ->

0 commit comments

Comments
 (0)