Skip to content

Commit 7b21b48

Browse files
committed
Move the check to be called on all queue types
1 parent 083889e commit 7b21b48

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

deps/rabbit/src/rabbit_channel.erl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,15 +1013,6 @@ check_msg_size(Content, GCThreshold) ->
10131013
Fmt, [Size, MaxMessageSize])
10141014
end.
10151015

1016-
check_vhost_queue_limit(#resource{name = QueueName}, VHost) ->
1017-
case rabbit_vhost_limit:is_over_queue_limit(VHost) of
1018-
false -> ok;
1019-
{true, Limit} -> rabbit_misc:precondition_failed("cannot declare queue '~ts': "
1020-
"queue limit in vhost '~ts' (~tp) is reached",
1021-
[QueueName, VHost, Limit])
1022-
1023-
end.
1024-
10251016
qbin_to_resource(QueueNameBin, VHostPath) ->
10261017
name_to_resource(queue, QueueNameBin, VHostPath).
10271018

@@ -2471,7 +2462,6 @@ handle_method(#'queue.declare'{queue = QueueNameBin,
24712462
{ok, QueueName, MessageCount, ConsumerCount};
24722463
{error, not_found} ->
24732464
%% enforce the limit for newly declared queues only
2474-
check_vhost_queue_limit(QueueName, VHostPath),
24752465
DlxKey = <<"x-dead-letter-exchange">>,
24762466
case rabbit_misc:r_arg(VHostPath, exchange, Args, DlxKey) of
24772467
undefined ->

deps/rabbit/src/rabbit_queue_type.erl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ is_compatible(Type, Durable, Exclusive, AutoDelete) ->
307307
declare(Q0, Node) ->
308308
Q = rabbit_queue_decorator:set(rabbit_policy:set(Q0)),
309309
Mod = amqqueue:get_type(Q),
310+
ok = check_vhost_queue_limit(Q),
310311
Mod:declare(Q, Node).
311312

312313
-spec delete(amqqueue:amqqueue(), boolean(),
@@ -765,3 +766,13 @@ known_queue_type_names() ->
765766
{QueueTypes, _} = lists:unzip(Registered),
766767
QTypeBins = lists:map(fun(X) -> atom_to_binary(X) end, QueueTypes),
767768
?KNOWN_QUEUE_TYPES ++ QTypeBins.
769+
770+
check_vhost_queue_limit(Q) ->
771+
#resource{name = QueueName} = amqqueue:get_name(Q),
772+
VHost = amqqueue:get_vhost(Q),
773+
case rabbit_vhost_limit:is_over_queue_limit(VHost) of
774+
false -> ok;
775+
{true, Limit} -> rabbit_misc:precondition_failed("cannot declare queue '~ts': "
776+
"queue limit in vhost '~ts' (~tp) is reached",
777+
[QueueName, VHost, Limit])
778+
end.

0 commit comments

Comments
 (0)