Skip to content

Commit 08168de

Browse files
Revert "Take policy-configured max-priority into account"
This reverts commit f5aa1fb. This feature wasn't available in the original implementation for a reason: policies are dynamic and can change after a queue's been declared. However, queue priorities are (at least currently) set in stone from the moment of queue creation. This was mentioned in the docs but not explicitly enough and got overlooked. Credit for the [re-]discovery goes to @acogoluegnes :) References #1590. [#157380396]
1 parent 4450006 commit 08168de

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

src/rabbit_amqqueue_process.erl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ process_args_policy(State = #q{q = Q,
382382
{<<"message-ttl">>, fun res_min/2, fun init_ttl/2},
383383
{<<"max-length">>, fun res_min/2, fun init_max_length/2},
384384
{<<"max-length-bytes">>, fun res_min/2, fun init_max_bytes/2},
385-
{<<"max-priority">>, fun res_arg/2, fun init_max_priority/2},
386385
{<<"overflow">>, fun res_arg/2, fun init_overflow/2},
387386
{<<"queue-mode">>, fun res_arg/2, fun init_queue_mode/2}],
388387
drop_expired_msgs(
@@ -427,9 +426,6 @@ init_max_bytes(MaxBytes, State) ->
427426
{_Dropped, State1} = maybe_drop_head(State#q{max_bytes = MaxBytes}),
428427
State1.
429428

430-
init_max_priority(_MaxPriority, State) ->
431-
State.
432-
433429
init_overflow(undefined, State) ->
434430
State;
435431
init_overflow(Overflow, State) ->

src/rabbit_priority_queue.erl

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
{requires, pre_boot},
2929
{enables, kernel_ready}]}).
3030

31-
-import(rabbit_misc, [pget/2]).
32-
3331
-export([enable/0]).
3432

3533
-export([start/2, stop/1]).
@@ -45,8 +43,6 @@
4543
info/2, invoke/3, is_duplicate/2, set_queue_mode/2,
4644
zip_msgs_and_acks/4, handle_info/2]).
4745

48-
-export([max_priority/1, priorities/1]).
49-
5046
-record(state, {bq, bqss, max_priority}).
5147
-record(passthrough, {bq, bqs}).
5248

@@ -129,19 +125,9 @@ collapse_recovery(QNames, DupNames, Recovery) ->
129125
end, dict:new(), lists:zip(DupNames, Recovery)),
130126
[dict:fetch(Name, NameToTerms) || Name <- QNames].
131127

132-
max_priority(Q = #amqqueue{arguments = Args}) ->
133-
case rabbit_misc:table_lookup(Args, <<"x-max-priority">>) of
134-
{Type, RequestedMax} -> {Type, RequestedMax};
135-
undefined ->
136-
case rabbit_policy:effective_definition(Q) of
137-
undefined -> undefined;
138-
Proplist -> {unsignedbyte, pget(<<"max-priority">>, Proplist)}
139-
end
140-
end.
141-
142-
priorities(Q) ->
128+
priorities(#amqqueue{arguments = Args}) ->
143129
Ints = [long, short, signedint, byte, unsignedbyte, unsignedshort, unsignedint],
144-
case max_priority(Q) of
130+
case rabbit_misc:table_lookup(Args, <<"x-max-priority">>) of
145131
{Type, RequestedMax} ->
146132
case lists:member(Type, Ints) of
147133
false -> none;

0 commit comments

Comments
 (0)