Skip to content

Commit

Permalink
Handle shutdown exits in gen_statem:call/3
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Jul 17, 2023
1 parent c1d2036 commit 3e7e199
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ra.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

-type consistent_query_ref() :: {From :: term(), Query :: ra:query_fun(), ConmmitIndex :: ra_index()}.

-type safe_call_ret(T) :: timeout | {error, noproc | nodedown} | T.
-type safe_call_ret(T) :: timeout | {error, noproc | nodedown | shutdown} | T.

-type states() :: leader | follower | candidate | await_condition.

Expand Down
4 changes: 3 additions & 1 deletion src/ra_server_proc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,9 @@ gen_statem_safe_call(ServerId, Msg, Timeout) ->
exit:{noproc, _} ->
{error, noproc};
exit:{{nodedown, _}, _} ->
{error, nodedown}
{error, nodedown};
exit:{shutdown, _} ->
{error, shutdown}
end.

do_state_query(all, State) -> State;
Expand Down

0 comments on commit 3e7e199

Please sign in to comment.