Skip to content

Commit

Permalink
Merge pull request #175 from emqx/fix-oldest
Browse files Browse the repository at this point in the history
fix(membership): leader calculation error in some cases
  • Loading branch information
HJianBo authored Jan 25, 2024
2 parents 986325b + 603bea2 commit e9075fb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mria_membership.erl
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ oldest(Members) ->
hd(lists:sort(fun compare/2, Members)).

%% @private
compare(#member{guid = undefined}, #member{guid = _}) ->
false;
compare(#member{guid = _}, #member{guid = undefined}) ->
true;
compare(M1, M2) ->
M1#member.guid < M2#member.guid.

Expand Down

0 comments on commit e9075fb

Please sign in to comment.