Skip to content

Commit daecdb0

Browse files
committed
QQ: introduce a delivery_limit default
If the delivery_limit of a quorum queue is not set by queue arg and/or policy it will now be defaulted to 20.
1 parent 74121d7 commit daecdb0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

deps/rabbit/src/rabbit_quorum_queue.erl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@
103103
-define(RA_SYSTEM, quorum_queues).
104104
-define(RA_WAL_NAME, ra_log_wal).
105105

106+
-define(DEFAULT_DELIVERY_LIMIT, 20).
107+
106108
-define(INFO(Str, Args),
107109
rabbit_log:info("[~s:~s/~b] " Str,
108110
[?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY | Args])).
@@ -320,7 +322,14 @@ ra_machine_config(Q) when ?is_amqqueue(Q) ->
320322
OverflowBin = args_policy_lookup(<<"overflow">>, fun policyHasPrecedence/2, Q),
321323
Overflow = overflow(OverflowBin, drop_head, QName),
322324
MaxBytes = args_policy_lookup(<<"max-length-bytes">>, fun min/2, Q),
323-
DeliveryLimit = args_policy_lookup(<<"delivery-limit">>, fun min/2, Q),
325+
DeliveryLimit = case args_policy_lookup(<<"delivery-limit">>, fun min/2, Q) of
326+
undefined ->
327+
rabbit_log:info("~ts: delivery_limit not set, defaulting to ~b",
328+
[rabbit_misc:rs(QName), ?DEFAULT_DELIVERY_LIMIT]),
329+
?DEFAULT_DELIVERY_LIMIT;
330+
DL ->
331+
DL
332+
end,
324333
Expires = args_policy_lookup(<<"expires">>, fun min/2, Q),
325334
MsgTTL = args_policy_lookup(<<"message-ttl">>, fun min/2, Q),
326335
#{name => Name,

0 commit comments

Comments
 (0)