Skip to content

Commit 35486d2

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 e4fa0e8 commit 35486d2

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

deps/rabbit/src/rabbit_channel.erl

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@
5656
-export([update_user_state/2]).
5757

5858
-export([init/1, terminate/2, code_change/3, handle_call/3, handle_cast/2,
59-
handle_info/2, handle_pre_hibernate/1, handle_post_hibernate/1,
60-
prioritise_call/4, prioritise_cast/3, prioritise_info/3,
61-
format_message_queue/2]).
59+
handle_info/2, format_status/1]).
6260

6361
%% Internal
6462
-export([list_local/0, emit_info_local/3, deliver_reply_local/3]).
@@ -557,26 +555,6 @@ init([Channel, ReaderPid, WriterPid, ConnPid, ConnName, Protocol, User, VHost,
557555
State3 = init_tick_timer(State2),
558556
{ok, State3}.
559557

560-
prioritise_call(Msg, _From, _Len, _State) ->
561-
case Msg of
562-
info -> 9;
563-
{info, _Items} -> 9;
564-
_ -> 0
565-
end.
566-
567-
prioritise_cast(Msg, _Len, _State) ->
568-
case Msg of
569-
{confirm, _MsgSeqNos, _QPid} -> 5;
570-
{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-
580558
handle_call(flush, _From, State) ->
581559
reply(ok, State);
582560

@@ -822,7 +800,13 @@ terminate(_Reason,
822800
code_change(_OldVsn, State, _Extra) ->
823801
{ok, State}.
824802

825-
format_message_queue(Opt, MQ) -> rabbit_misc:format_message_queue(Opt, MQ).
803+
format_status(Status) ->
804+
maps:map(
805+
fun(state, State = #ch{unacked_message_q = UnackedMessageQ}) ->
806+
State#ch{unacked_message_q = lqueue:len(UnackedMessageQ)};
807+
(_,Value) ->
808+
Value
809+
end, Status).
826810

827811
get_consumer_timeout() ->
828812
case application:get_env(rabbit, consumer_timeout) of

0 commit comments

Comments
 (0)