Skip to content

Commit

Permalink
Handle message outside of selective receive
Browse files Browse the repository at this point in the history
If the selective receive times out - then need to handle the release message
  • Loading branch information
martinsumner committed Mar 27, 2024
1 parent 43fab28 commit eeba0ad
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/riak_kv_vnode.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1497,11 +1497,14 @@ handle_command({reset_hashtree_tokens, MinToken, MaxToken}, _Sender, State) ->

handle_command({block_vnode, BlockRequest, BlockTimeMS}, Sender, State) ->
riak_core_vnode:reply(Sender, {blocked, self()}),
SW = os:timestamp(),
receive
{release_vnode, BlockRequest} ->
LockedTime = timer:now_diff(os:timestamp(), SW),
?LOG_INFO(
"Vnode block released for ~w request ~w",
[Sender, BlockRequest]),
"Vnode block released for ~w request ~w after"
"block_time=~w microseconds",
[Sender, BlockRequest, LockedTime]),
{noreply, State}
after
BlockTimeMS ->
Expand Down Expand Up @@ -2665,6 +2668,12 @@ handle_info({aae_pong, QueueTime}, State) ->
ok
end,
{ok, State};
handle_info({release_vnode, BlockRequest}, State) ->
?LOG_WARNING(
"Vnode block release request ~w received outside of block",
[BlockRequest]
),
{ok, State};
handle_info({Ref, ok}, State) ->
?LOG_INFO("Ignoring ok returned after timeout for Ref ~p", [Ref]),
{ok, State}.
Expand Down

0 comments on commit eeba0ad

Please sign in to comment.