Fix wait_for_connection to tolerate badrpc

This commit is contained in:
Andrew Thompson 2013-06-03 13:36:10 -04:00
parent f9972d8e11
commit a24c091f27

View File

@ -178,20 +178,24 @@ disconnect_cluster(Node, Name) ->
wait_for_connection(Node, Name) ->
rt:wait_until(Node,
fun(_) ->
{ok, Connections} = rpc:call(Node, riak_core_cluster_mgr,
get_connections, []),
Conn = [P || {{cluster_by_name, N}, P} <- Connections, N == Name],
case Conn of
[] ->
false;
[Pid] ->
Pid ! {self(), status},
receive
{Pid, status, _} ->
true;
{Pid, connecting, _} ->
false
end
case rpc:call(Node, riak_core_cluster_mgr,
get_connections, []) of
{ok, Connections} ->
Conn = [P || {{cluster_by_name, N}, P} <- Connections, N == Name],
case Conn of
[] ->
false;
[Pid] ->
Pid ! {self(), status},
receive
{Pid, status, _} ->
true;
{Pid, connecting, _} ->
false
end
end;
_ ->
false
end
end).