Skip to content

Commit 4987fe1

Browse files
committed
Add rabbit.stream_cmd_timeout setting for coordinator commands
1 parent 20fba86 commit 4987fe1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

deps/rabbit/src/rabbit_stream_coordinator.erl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,16 @@ process_command(Cmd) ->
437437
process_command([], _Cmd) ->
438438
{error, coordinator_unavailable};
439439
process_command([Server | Servers], Cmd) ->
440-
case ra:process_command(Server, Cmd, ?CMD_TIMEOUT) of
440+
case ra:process_command(Server, Cmd, cmd_timeout()) of
441441
{timeout, _} ->
442+
CmdLabel = case Cmd of
443+
{sac, SacCmd} ->
444+
element(1, SacCmd);
445+
_ ->
446+
element(1, Cmd)
447+
end,
442448
rabbit_log:warning("Coordinator timeout on server ~w when processing command ~W",
443-
[element(2, Server), element(1, Cmd), 10]),
449+
[element(2, Server), CmdLabel, 10]),
444450
process_command(Servers, Cmd);
445451
{error, noproc} ->
446452
process_command(Servers, Cmd);
@@ -450,6 +456,9 @@ process_command([Server | Servers], Cmd) ->
450456
Reply
451457
end.
452458

459+
cmd_timeout() ->
460+
application:get_env(rabbit, stream_cmd_timeout, ?CMD_TIMEOUT).
461+
453462
ensure_coordinator_started() ->
454463
Local = {?MODULE, node()},
455464
ExpectedMembers = expected_coord_members(),

0 commit comments

Comments
 (0)