Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 10 additions & 20 deletions deps/rabbit/src/mirrored_supervisor.erl
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,16 @@ handle_info({'DOWN', _Ref, process, Pid, _Reason},
child_order = ChildOrder}) ->
%% No guarantee pg will have received the DOWN before us.
R = case lists:sort(pg:get_members(Group)) -- [Pid] of
[O | _] -> ChildSpecs = retry_update_all(O, Pid),
[start(Delegate, ChildSpec)
|| ChildSpec <- restore_child_order(ChildSpecs,
ChildOrder)];
[O | _] -> ChildSpecs = update_all(O, Pid),
case ChildSpecs of
_ when is_list(ChildSpecs) ->
[start(Delegate, ChildSpec)
|| ChildSpec <- restore_child_order(
ChildSpecs,
ChildOrder)];
{error, _} ->
[ChildSpecs]
end;
_ -> []
end,
case errors(R) of
Expand Down Expand Up @@ -428,22 +434,6 @@ check_stop(Group, Delegate, Id) ->

id({Id, _, _, _, _, _}) -> Id.

retry_update_all(O, Pid) ->
retry_update_all(O, Pid, 10000).

retry_update_all(O, Pid, TimeLeft) when TimeLeft > 0 ->
case update_all(O, Pid) of
List when is_list(List) ->
List;
{error, timeout} ->
Sleep = 200,
TimeLeft1 = TimeLeft - Sleep,
timer:sleep(Sleep),
retry_update_all(O, Pid, TimeLeft1)
end;
retry_update_all(O, Pid, _TimeLeft) ->
update_all(O, Pid).

update_all(Overall, OldOverall) ->
rabbit_db_msup:update_all(Overall, OldOverall).

Expand Down
Loading