Skip to content

Commit 22a0c2a

Browse files
lukebakkenmichaelklishin
authored andcommitted
Correctly implement format_state/1 in rabbit_priority_queue
The previous implementation did not take the unique `passthrough` record into account when formatting state. To test the priority and non-priority scenarios, add `exit(kaboom)` in `rabbit_amqqueue_process` `handle_call({basic_consume...` then run PerfTest with these arguments: ``` --producers 1 --consumers 1 --pmessages 100 --queue-args x-max-priority=10 --producers 1 --consumers 1 --pmessages 100 ```
1 parent ad4c802 commit 22a0c2a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

deps/rabbit/src/rabbit_priority_queue.erl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -665,11 +665,15 @@ zip_msgs_and_acks(Pubs, AckTags) ->
665665
{Id, AckTag}
666666
end, Pubs, AckTags).
667667

668-
format_state(S = #passthrough{bq = BQ, bqs = BQS0}) ->
668+
format_state(State = #state{bq = BQ, bqss = BQSs0}) when is_list(BQSs0) ->
669669
case erlang:function_exported(BQ, format_state, 1) of
670670
true ->
671-
BQS1 = BQ:format_state(BQS0),
672-
S#passthrough{bqs = BQS1};
671+
BQSs1 = foreach1(fun (_Priority, BQSN) ->
672+
BQ:format_state(BQSN)
673+
end, State),
674+
State#state{bqss = BQSs1};
673675
_ ->
674-
S#passthrough{bqs = passthrough_bqs_truncated}
675-
end.
676+
State#state{bqss = bqss_truncated}
677+
end;
678+
format_state(State = #passthrough{bq = BQ, bqs = BQS}) ->
679+
?passthrough1(format_state(BQS)).

0 commit comments

Comments
 (0)