diff options
| author | Michael Klishin <mklishin@pivotal.io> | 2020-01-24 16:34:43 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-24 16:34:43 +0300 |
| commit | ef19280a28b6e5180e9ed3efefb9d2743c221ef3 (patch) | |
| tree | 875fe86ba1709e62dfaa9a3fb9065087206a6258 /src | |
| parent | f618e7e766bb20ce4e99d9a67751b512b10d64a5 (diff) | |
| parent | f5d8d88e728cf08f971ba7acd3567aebc94a91d6 (diff) | |
| download | rabbitmq-server-git-ef19280a28b6e5180e9ed3efefb9d2743c221ef3.tar.gz | |
Merge pull request #2219 from rabbitmq/revisit-rabbit-start_apps-2
rabbit: Change start_apps/2 to call application:ensure_all_started/2
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit.erl | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 292272738d..35ffc6ea16 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -599,21 +599,27 @@ start_apps(Apps) -> -spec start_apps([app_name()], #{app_name() => restart_type()}) -> 'ok'. +%% TODO: start_apps/2 and start_loaded_apps/2 are now specific to +%% plugins. Those function should be moved over `rabbit_plugins`, along +%% with top_apps/1, once the latter stops using app_utils as well. + start_apps(Apps, RestartTypes) -> app_utils:load_applications(Apps), ok = rabbit_feature_flags:refresh_feature_flags_after_app_load(Apps), start_loaded_apps(Apps, RestartTypes). start_loaded_apps(Apps, RestartTypes) -> + false = lists:member(rabbit, Apps), %% Assertion. rabbit_prelaunch_conf:decrypt_config(Apps), - OrderedApps = app_utils:app_dependency_order(Apps, false), - case lists:member(rabbit, Apps) of - false -> rabbit_boot_steps:run_boot_steps(Apps); %% plugin activation - true -> ok %% will run during start of rabbit app - end, - ok = app_utils:start_applications(OrderedApps, - handle_app_error(could_not_start), - RestartTypes). + lists:foreach( + fun(App) -> + RestartType = maps:get(App, RestartTypes, temporary), + ok = rabbit_boot_steps:run_boot_steps([App]), + case application:ensure_all_started(App, RestartType) of + {ok, _} -> ok; + {error, Reason} -> throw({could_not_start, App, Reason}) + end + end, Apps). -spec stop_apps([app_name()]) -> 'ok'. |
