summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2011-06-28 16:57:23 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2011-06-28 16:57:23 +0100
commit32331e5f2c86b0f08957a2353cf79be75d89e6ad (patch)
treebe5b45042ab57ad0cfcb0605d82e8cada89df2df
parent35b76af72622664b6d59f41e34811934e181ebc2 (diff)
downloadrabbitmq-server-32331e5f2c86b0f08957a2353cf79be75d89e6ad.tar.gz
factorisationbug24207
-rw-r--r--src/rabbit.erl19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 5ec0611a..2a7369c0 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -406,11 +406,9 @@ load_applications(Worklist, Loaded) ->
Error -> throw(Error)
end,
load_applications(
- case application:get_key(App, applications) of
- undefined -> Worklist1;
- {ok, Lst} -> queue:join(Worklist1,
- queue:from_list(Lst))
- end, sets:add_element(App, Loaded))
+ queue:join(Worklist1,
+ queue:from_list(app_dependencies(App))),
+ sets:add_element(App, Loaded))
end
end.
@@ -418,10 +416,7 @@ application_load_order() ->
ok = load_applications(),
{ok, G} = rabbit_misc:build_acyclic_graph(
fun application_graph_vertex/2, fun application_graph_edge/2,
- [{App, case application:get_key(App, applications) of
- undefined -> [];
- {ok, Lst} -> Lst
- end} ||
+ [{App, app_dependencies(App)} ||
{App, _Desc, _Vsn} <- application:loaded_applications()]),
true = digraph:del_vertices(
G, digraph:vertices(G) -- digraph_utils:reachable(?APPS, G)),
@@ -429,6 +424,12 @@ application_load_order() ->
true = digraph:delete(G),
Result.
+app_dependencies(App) ->
+ case application:get_key(App, applications) of
+ undefined -> [];
+ {ok, Lst} -> Lst
+ end.
+
application_graph_vertex(App, _Deps) -> [{App, App}].
application_graph_edge(App, Deps) -> [{Dep, App} || Dep <- Deps].