fix(boot): ensure emqx_conf is the first app to boot
The first one to boot after emqx_machine
This commit is contained in:
parent
65b1ce80d9
commit
2fbe2dd0c3
|
@ -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})
|
||||||
|
|
|
@ -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})
|
||||||
|
|
Loading…
Reference in New Issue