Skip to content
Merged
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
23 changes: 4 additions & 19 deletions deps/rabbit/src/rabbit_khepri.erl
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,6 @@ retry_timeout() ->
undefined -> 300_000
end.

retry_limit() ->
case application:get_env(rabbit, khepri_leader_wait_retry_limit) of
{ok, T} -> T;
undefined -> 10
end.

%% @private

-spec init(IsVirgin) -> Ret when
Expand Down Expand Up @@ -333,22 +327,13 @@ init(IsVirgin) ->
end.

await_replication() ->
await_replication(retry_timeout(), retry_limit()).

await_replication(_Timeout, 0) ->
{error, timeout};
await_replication(Timeout, Retries) ->
Timeout = retry_timeout(),
?LOG_DEBUG(
"Khepri-based " ?RA_FRIENDLY_NAME " waiting to catch up on replication "
"to the Raft cluster leader. Waiting for ~tb ms, ~tb retries left",
[Timeout, Retries],
"to the Raft cluster leader. Waiting for ~tb ms",
[Timeout],
#{domain => ?RMQLOG_DOMAIN_DB}),
case fence(Timeout) of
ok ->
ok;
{error, timeout} ->
await_replication(Timeout, Retries -1)
end.
fence(Timeout).

%% @private

Expand Down
Loading