Skip to content

Commit 9987bef

Browse files
committed
Do not include x-delivery-count header on first delivery.
[#162755631]
1 parent 4cf67e8 commit 9987bef

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/rabbit_channel.erl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2527,9 +2527,10 @@ maybe_monitor_all([], S) -> S; %% optimisation
25272527
maybe_monitor_all([Item], S) -> maybe_monitor(Item, S); %% optimisation
25282528
maybe_monitor_all(Items, S) -> lists:foldl(fun maybe_monitor/2, S, Items).
25292529

2530-
add_delivery_count_header(MsgHeader, Msg) ->
2531-
Count = maps:get(delivery_count, MsgHeader, 0),
2532-
rabbit_basic:add_header(<<"x-delivery-count">>, long, Count, Msg).
2530+
add_delivery_count_header(#{delivery_count := Count}, Msg) ->
2531+
rabbit_basic:add_header(<<"x-delivery-count">>, long, Count, Msg);
2532+
add_delivery_count_header(_, Msg) ->
2533+
Msg.
25332534

25342535
qpid_to_ref(Pid) when is_pid(Pid) -> Pid;
25352536
qpid_to_ref({Name, _}) -> Name;

test/quorum_queue_SUITE.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,7 @@ subscribe_redelivery_count(Config) ->
19881988
{#'basic.deliver'{delivery_tag = DeliveryTag,
19891989
redelivered = false},
19901990
#amqp_msg{props = #'P_basic'{headers = H0}}} ->
1991-
?assertMatch({DTag, _, 0}, rabbit_basic:header(DTag, H0)),
1991+
?assertMatch(undefined, rabbit_basic:header(DTag, H0)),
19921992
amqp_channel:cast(Ch, #'basic.nack'{delivery_tag = DeliveryTag,
19931993
multiple = false,
19941994
requeue = true})

0 commit comments

Comments
 (0)