Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ?NOPROC_RETRY_INTERVAL to ?TRANSIENT_ERROR_RETRY_INTERVAL #288

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/khepri_cluster.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,8 @@ do_query_members(StoreId, RaServer, QueryType, Timeout) ->
true ->
NewTimeout0 = khepri_utils:end_timeout_window(Timeout, T0),
NewTimeout = khepri_utils:sleep(
?NOPROC_RETRY_INTERVAL, NewTimeout0),
?TRANSIENT_ERROR_RETRY_INTERVAL,
NewTimeout0),
do_query_members(
StoreId, RaServer, QueryType, NewTimeout);
false ->
Expand All @@ -1243,7 +1244,7 @@ do_query_members(StoreId, RaServer, QueryType, Timeout) ->
Reason == shutdown) ->
NewTimeout0 = khepri_utils:end_timeout_window(Timeout, T0),
NewTimeout = khepri_utils:sleep(
?NOPROC_RETRY_INTERVAL, NewTimeout0),
?TRANSIENT_ERROR_RETRY_INTERVAL, NewTimeout0),
do_query_members(
StoreId, RaServer, QueryType, NewTimeout);
{timeout, _} ->
Expand Down
6 changes: 3 additions & 3 deletions src/khepri_cluster.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
-define(DEFAULT_RA_SYSTEM_NAME, khepri).
-define(DEFAULT_STORE_ID, khepri).

%% timer:sleep/1 time used as a retry interval when the local Ra server is
%% unaware of a leader exit.
-define(NOPROC_RETRY_INTERVAL, 200).
%% timer:sleep/1 time used as a retry interval when we get errors such as
%% `noproc' or `noconnection'.
-define(TRANSIENT_ERROR_RETRY_INTERVAL, 200).

-define(IS_TIMEOUT(Timeout), (Timeout =:= infinity orelse
(is_integer(Timeout) andalso Timeout >= 0))).
Expand Down
3 changes: 2 additions & 1 deletion src/khepri_machine.erl
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,8 @@ do_process_sync_command(StoreId, Command, Options) ->
%% Retry again after waiting a bit.
NewTimeout0 = khepri_utils:end_timeout_window(Timeout, T0),
NewTimeout = khepri_utils:sleep(
?NOPROC_RETRY_INTERVAL, NewTimeout0),
?TRANSIENT_ERROR_RETRY_INTERVAL,
NewTimeout0),
Options1 = Options#{timeout => NewTimeout},
do_process_sync_command(StoreId, Command, Options1);
false ->
Expand Down