fix(boot): ensure emqx_conf is the first app to boot

The first one to boot after emqx_machine
This commit is contained in:
Zaiming (Stone) Shi 2022-01-03 12:02:51 +01:00
parent 65b1ce80d9
commit 2fbe2dd0c3
2 changed files with 3 additions and 3 deletions

View File

@ -85,7 +85,6 @@ reboot_apps() ->
, esockd , esockd
, ranch , ranch
, cowboy , cowboy
, emqx_conf
, emqx , emqx
, emqx_prometheus , emqx_prometheus
, emqx_modules , emqx_modules
@ -121,7 +120,8 @@ sorted_reboot_apps(Apps) ->
NoDepApps = add_apps_to_digraph(G, Apps), NoDepApps = add_apps_to_digraph(G, Apps),
case digraph_utils:topsort(G) of case digraph_utils:topsort(G) of
Sorted when is_list(Sorted) -> Sorted when is_list(Sorted) ->
Sorted ++ (NoDepApps -- Sorted); %% ensure emqx_conf boot up first
[emqx_conf | Sorted ++ (NoDepApps -- Sorted)];
false -> false ->
Loops = find_loops(G), Loops = find_loops(G),
error({circular_application_dependency, Loops}) error({circular_application_dependency, Loops})

View File

@ -38,7 +38,7 @@ sorted_reboot_apps_cycle_test() ->
check_order(Apps) -> check_order(Apps) ->
AllApps = lists:usort(lists:append([[A | Deps] || {A, Deps} <- Apps])), AllApps = lists:usort(lists:append([[A | Deps] || {A, Deps} <- Apps])),
Sorted = emqx_machine_boot:sorted_reboot_apps(Apps), [emqx_conf | Sorted] = emqx_machine_boot:sorted_reboot_apps(Apps),
case length(AllApps) =:= length(Sorted) of case length(AllApps) =:= length(Sorted) of
true -> ok; true -> ok;
false -> error({AllApps, Sorted}) false -> error({AllApps, Sorted})