Skip to content

Commit 8757911

Browse files
committed
Add cluster connect timeout
1 parent b45e6e6 commit 8757911

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/basho_bench.erl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
-include("basho_bench.hrl").
2929

3030

31+
-define(AWAIT_TIMEOUT, 10000).
32+
33+
3134
start() ->
3235
application:ensure_all_started(basho_bench).
3336

@@ -414,13 +417,18 @@ await_nodes(NodeCount) ->
414417
await_nodes(NodeCount, 100).
415418

416419
await_nodes(NodeCount, SleepMS) ->
420+
await_nodes(NodeCount, SleepMS, ?AWAIT_TIMEOUT).
421+
422+
await_nodes(_, _, Timeout) when Timeout < 0 ->
423+
throw({error, await_node_timeout});
424+
await_nodes(NodeCount, SleepMS, Timeout) ->
417425
case NodeCount =:= length(nodes()) + 1 of
418426
true ->
419427
ok;
420428
false ->
421429
?INFO("Waiting on ~p nodes to connect~n", [NodeCount - length(nodes()) - 1]),
422430
timer:sleep(SleepMS),
423-
await_nodes(NodeCount, SleepMS * 2)
431+
await_nodes(NodeCount, SleepMS * 2, Timeout - SleepMS)
424432
end.
425433

426434
bootstrap_bb() ->

0 commit comments

Comments
 (0)