Skip to content

Commit 31d60f8

Browse files
dcorbachomergify[bot]
authored andcommitted
Shovel AMQP10 bugfix: handle errors when alarms are set
When an alarm is set in the destination cluster, the AMQP10 shovel receives a remote_incoming_window_exceeded error. It must handle it and retry the send later on, until the alarm is cleared (cherry picked from commit 822f800)
1 parent 258b5db commit 31d60f8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

deps/rabbitmq_shovel/src/rabbit_amqp10_shovel.erl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
-include_lib("kernel/include/logger.hrl").
4343

4444
-define(LINK_CREDIT_TIMEOUT, 20_000).
45+
-define(AWAIT_SEND_MSG_TIMEOUT, 1_000).
4546

4647
-type state() :: rabbit_shovel_behaviour:state().
4748
-type uri() :: rabbit_shovel_behaviour:uri().
@@ -374,7 +375,11 @@ send_msg(Link, Msg) ->
374375
send_msg(Link, Msg)
375376
after ?LINK_CREDIT_TIMEOUT ->
376377
{stop, credited_timeout}
377-
end
378+
end;
379+
{error, remote_incoming_window_exceeded} ->
380+
%% We could be blocked because of an alarm
381+
timer:sleep(?AWAIT_SEND_MSG_TIMEOUT),
382+
send_msg(Link, Msg)
378383
end.
379384

380385
add_timestamp_header(#{dest := #{add_timestamp_header := true}}, Msg) ->

0 commit comments

Comments
 (0)