Skip to content

Commit

Permalink
Force timeout to trigger (#3)
Browse files Browse the repository at this point in the history
Previously, the inactivity timeout on handle_continue could be cancelled by a call to riak_kv_rpelrtq_snk (e.g. from riak_kv_rpelrtq_peer).  this might lead to the log_stats loop never being triggered.
  • Loading branch information
martinsumner committed Nov 14, 2023
1 parent dea4170 commit 763f749
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/riak_kv_replrtq_snk.erl
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ handle_cast({requeue_work, WorkItem}, State) ->
{noreply, State}
end.

handle_info(timeout, State) ->
handle_info(deferred_start, State) ->
prompt_work(),
erlang:send_after(?LOG_TIMER_SECONDS * 1000, self(), log_stats),
{noreply, State};
Expand Down Expand Up @@ -440,7 +440,8 @@ handle_continue(initialise_work, State) ->
{SnkQueueName, Iteration, SnkW}
end,
Work = lists:map(MapPeerInfoFun, SnkQueuePeerInfo),
{noreply, State#state{enabled = true, work = Work}, ?INITIAL_TIMEOUT_MS}.
erlang:send_after(?INITIAL_TIMEOUT_MS, self(), deferred_start),
{noreply, State#state{enabled = true, work = Work}}.

terminate(_Reason, State) ->
WorkItems = lists:map(fun(SW) -> element(3, SW) end, State#state.work),
Expand Down

0 comments on commit 763f749

Please sign in to comment.