Skip to content

Commit 5a86545

Browse files
committed
Remove GS2 priority_* callbacks; format_status
`format_status` replaces the queue of pending messages, which is sometimes very long, with just the number of messages pending.
1 parent 9a06e70 commit 5a86545

File tree

1 file changed

+8
-26
lines changed

1 file changed

+8
-26
lines changed

deps/rabbit/src/rabbit_channel.erl

+8-26
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@
5454
-export([update_user_state/2]).
5555

5656
-export([init/1, terminate/2, code_change/3, handle_call/3, handle_cast/2,
57-
handle_info/2, handle_pre_hibernate/1, handle_post_hibernate/1,
58-
prioritise_call/4, prioritise_cast/3, prioritise_info/3,
59-
format_message_queue/2]).
57+
handle_info/2, format_status/1]).
6058

6159
%% Internal
6260
-export([list_local/0, emit_info_local/3, deliver_reply_local/3]).
@@ -555,28 +553,6 @@ init([Channel, ReaderPid, WriterPid, ConnPid, ConnName, Protocol, User, VHost,
555553
State3 = init_tick_timer(State2),
556554
{ok, State3}.
557555

558-
prioritise_call(Msg, _From, _Len, _State) ->
559-
case Msg of
560-
info -> 9;
561-
{info, _Items} -> 9;
562-
_ -> 0
563-
end.
564-
565-
prioritise_cast(Msg, _Len, _State) ->
566-
case Msg of
567-
{confirm, _MsgSeqNos, _QPid} -> 5;
568-
{reject_publish, _MsgSeqNos, _QPid} -> 5;
569-
{queue_event, _, {confirm, _MsgSeqNos, _QPid}} -> 5;
570-
{queue_event, _, {reject_publish, _MsgSeqNos, _QPid}} -> 5;
571-
_ -> 0
572-
end.
573-
574-
prioritise_info(Msg, _Len, _State) ->
575-
case Msg of
576-
emit_stats -> 7;
577-
_ -> 0
578-
end.
579-
580556
handle_call(flush, _From, State) ->
581557
reply(ok, State);
582558

@@ -813,7 +789,13 @@ terminate(_Reason,
813789
code_change(_OldVsn, State, _Extra) ->
814790
{ok, State}.
815791

816-
format_message_queue(Opt, MQ) -> rabbit_misc:format_message_queue(Opt, MQ).
792+
format_status(Status) ->
793+
maps:map(
794+
fun(state, State = #ch{unacked_message_q = UnackedMessageQ}) ->
795+
State#ch{unacked_message_q = lqueue:len(UnackedMessageQ)};
796+
(_,Value) ->
797+
Value
798+
end, Status).
817799

818800
get_consumer_timeout() ->
819801
case application:get_env(rabbit, consumer_timeout) of

0 commit comments

Comments
 (0)