Skip to content

Commit ae739cc

Browse files
committed
amqqueue_process: adopt new is_duplicate backing queue callback
As the de-duplication plugin is the only adopter of the `is_duplicate` callback, we now use a simpler signature. When a message is deemed duplicated, we discard it and re-route it to dead letter exchange. Signed-off-by: Matteo Cafasso <[email protected]>
1 parent 6a979b6 commit ae739cc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

deps/rabbit/src/rabbit_amqqueue_process.erl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,10 @@ maybe_deliver_or_enqueue(Delivery = #delivery{message = Message},
722722
%% Drop publish and nack to publisher
723723
send_reject_publish(Delivery, State);
724724
_ ->
725-
case BQ:is_duplicate(Message, BQS) of
726-
{true, State1} ->
725+
{IsDuplicate, BQS1} = BQ:is_duplicate(Message, BQS),
726+
State1 = State#q{backing_queue_state = BQS1},
727+
case IsDuplicate of
728+
true ->
727729
%% Publish to DLX
728730
_ = with_dlx(
729731
DLX,
@@ -741,8 +743,8 @@ maybe_deliver_or_enqueue(Delivery = #delivery{message = Message},
741743
end),
742744
%% Drop publish and nack to publisher
743745
send_reject_publish(Delivery, State1);
744-
%% Enqueue and maybe drop head later
745-
{false, State1} ->
746+
false ->
747+
%% Enqueue and maybe drop head later
746748
deliver_or_enqueue(Delivery, Delivered, State1)
747749
end
748750
end.

0 commit comments

Comments
 (0)