summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit.erl9
-rw-r--r--src/rabbit_queue_index.erl6
-rw-r--r--src/rabbit_tests.erl2
3 files changed, 10 insertions, 7 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 215c1bc421..016a461a33 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -37,7 +37,7 @@
-export([start/2, stop/1]).
--export([log_location/1]).
+-export([log_location/1, start_child/2]).
-import(application).
-import(mnesia).
@@ -67,6 +67,7 @@
{nodes, [erlang_node()]} |
{running_nodes, [erlang_node()]}]).
-spec(log_location/1 :: ('sasl' | 'kernel') -> log_location()).
+-spec(start_child/2 :: (atom(), [any()]) -> 'ok').
-endif.
@@ -155,7 +156,6 @@ start(normal, []) ->
fun () ->
ok = maybe_insert_default_data(),
ok = rabbit_exchange:recover(),
- %% TODO - this should probably use start_child somehow too
DurableQueues = rabbit_amqqueue:find_durable_queues(),
ok = rabbit_queue_index:start_msg_store(DurableQueues),
{ok, _RealDurableQueues} = rabbit_amqqueue:recover(DurableQueues)
@@ -267,8 +267,11 @@ print_banner() ->
io:nl().
start_child(Mod) ->
+ start_child(Mod, []).
+
+start_child(Mod, Args) ->
{ok,_} = supervisor:start_child(rabbit_sup,
- {Mod, {Mod, start_link, []},
+ {Mod, {Mod, start_link, Args},
transient, 5000, worker, [Mod]}),
ok.
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl
index 4ed22cec3f..5eed90b0bd 100644
--- a/src/rabbit_queue_index.erl
+++ b/src/rabbit_queue_index.erl
@@ -332,9 +332,9 @@ start_msg_store(DurableQueues) ->
end
end, {[], []}, Directories),
MsgStoreDir = filename:join(rabbit_mnesia:dir(), "msg_store"),
- {ok, _Pid} = rabbit_msg_store:start_link(MsgStoreDir,
- fun queue_index_walker/1,
- DurableQueueNames),
+ ok = rabbit:start_child(rabbit_msg_store, [MsgStoreDir,
+ fun queue_index_walker/1,
+ DurableQueueNames]),
lists:foreach(fun (DirName) ->
Dir = filename:join(queues_dir(), DirName),
ok = delete_queue_directory(Dir)
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl
index 7bf480d728..390ff2ef6b 100644
--- a/src/rabbit_tests.erl
+++ b/src/rabbit_tests.erl
@@ -1022,7 +1022,7 @@ verify_read_with_published(_Delivered, _Persistent, _Read, _Published) ->
ko.
test_queue_index() ->
- rabbit_msg_store:stop(),
+ io:format("~p~n", [rabbit_msg_store:stop()]),
ok = empty_test_queue(),
SeqIdsA = lists:seq(1,10000),
SeqIdsB = lists:seq(10001,20000),