Skip to content

Commit

Permalink
Always return status in requested order
Browse files Browse the repository at this point in the history
Summary:
Change `wa_raft_server:status/2` to always return the requested status fields in the order that they
are requested in.

Reviewed By: jaher

Differential Revision: D70842264

fbshipit-source-id: 395d10e7f0d204dfc79b73b0641f4e4d8d8001b4
  • Loading branch information
hsun324 authored and facebook-github-bot committed Mar 9, 2025
1 parent b2e3e5e commit 2b8c63c
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/wa_raft_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,7 @@ status(ServerRef, Key) when is_atom(Key) ->
status(ServerRef, Keys) when is_list(Keys) ->
case status(ServerRef) of
[_|_] = Status ->
FilterFun =
fun({Key, Value}) ->
case lists:member(Key, Keys) of
true -> {true, Value};
false -> false
end
end,
lists:filtermap(FilterFun, Status);
[proplists:get_value(Key, Status, undefined) || Key <- Keys];
_ ->
lists:duplicate(length(Keys), undefined)
end.
Expand Down

0 comments on commit 2b8c63c

Please sign in to comment.