Skip to content

Commit

Permalink
Trigger GC right away after sending logs in wa_raft_catchup_log
Browse files Browse the repository at this point in the history
Summary: These processes are idle most of the time, except when we need to do incremental catchup. Release garbage right away after catchup.

Differential Revision: D60009454

fbshipit-source-id: a23f82ef8b3aef3b12956499a866f9386b406934
  • Loading branch information
Jose-Angel Herrero Bajo authored and facebook-github-bot committed Jul 23, 2024
1 parent 8bf387e commit ec5d164
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/wa_raft_log_catchup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ handle_info(timeout, #state{name = Name} = State) ->
Requests ->
% Select a random log catchup request to process.
?CATCHUP_REQUEST(Peer, FollowerLastIndex, LeaderTerm, LeaderCommitIndex, Witness) = lists:nth(rand:uniform(length(Requests)), Requests),
{noreply, send_logs(Peer, FollowerLastIndex, LeaderTerm, LeaderCommitIndex, Witness, State), ?CONTINUE_TIMEOUT}
NewState = send_logs(Peer, FollowerLastIndex, LeaderTerm, LeaderCommitIndex, Witness, State),
% erlint-ignore garbage_collect
erlang:garbage_collect(),
{noreply, NewState, ?CONTINUE_TIMEOUT}
end;
handle_info(Info, #state{name = Name} = State) ->
?LOG_WARNING("Unexpected info ~0P on ~0p", [Info, 30, Name], #{domain => [whatsapp, wa_raft]}),
Expand Down

0 comments on commit ec5d164

Please sign in to comment.