Skip to content

Commit e4bac3a

Browse files
committed
Merge pull request #2049 from rabbitmq/pt-166962656-stats-failure-38-lre
Remove deprecation of force_event_refresh message (cherry picked from commit c93c3cc)
1 parent e9c4165 commit e4bac3a

File tree

5 files changed

+35
-4
lines changed

5 files changed

+35
-4
lines changed

src/rabbit.erl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,11 +1054,16 @@ start_logger() ->
10541054
log_locations() ->
10551055
rabbit_lager:log_locations().
10561056

1057+
-spec force_event_refresh(reference()) -> 'ok'.
1058+
1059+
% Note: https://www.pivotaltracker.com/story/show/166962656
1060+
% This event is necessary for the stats timer to be initialized with
1061+
% the correct values once the management agent has started
10571062
force_event_refresh(Ref) ->
1058-
rabbit_direct:force_event_refresh(Ref),
1059-
rabbit_networking:force_connection_event_refresh(Ref),
1060-
rabbit_channel:force_event_refresh(Ref),
1061-
rabbit_amqqueue:force_event_refresh(Ref).
1063+
ok = rabbit_direct:force_event_refresh(Ref),
1064+
ok = rabbit_networking:force_connection_event_refresh(Ref),
1065+
ok = rabbit_channel:force_event_refresh(Ref),
1066+
ok = rabbit_amqqueue:force_event_refresh(Ref).
10621067

10631068
%%---------------------------------------------------------------------------
10641069
%% misc

src/rabbit_amqqueue.erl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,9 @@ list_local(VHostPath) ->
813813
State =/= crashed,
814814
node() =:= node(QPid) ].
815815

816+
% Note: https://www.pivotaltracker.com/story/show/166962656
817+
% This event is necessary for the stats timer to be initialized with
818+
% the correct values once the management agent has started
816819
force_event_refresh(Ref) ->
817820
[gen_server2:cast(Q#amqqueue.pid,
818821
{force_event_refresh, Ref}) || Q <- list()],

src/rabbit_amqqueue_process.erl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,9 @@ handle_cast({credit, ChPid, CTag, Credit, Drain},
14351435
run_message_queue(true, State1)
14361436
end);
14371437

1438+
% Note: https://www.pivotaltracker.com/story/show/166962656
1439+
% This event is necessary for the stats timer to be initialized with
1440+
% the correct values once the management agent has started
14381441
handle_cast({force_event_refresh, Ref},
14391442
State = #q{consumers = Consumers,
14401443
exclusive_consumer = Exclusive}) ->

src/rabbit_channel.erl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969
-export([init/1, terminate/2, code_change/3, handle_call/3, handle_cast/2,
7070
handle_info/2, handle_pre_hibernate/1, prioritise_call/4,
7171
prioritise_cast/3, prioritise_info/3, format_message_queue/2]).
72+
handle_info/2, handle_pre_hibernate/1, handle_post_hibernate/1,
73+
prioritise_call/4, prioritise_cast/3, prioritise_info/3,
74+
format_message_queue/2]).
75+
7276
%% Internal
7377
-export([list_local/0, emit_info_local/3, deliver_reply_local/3]).
7478
-export([get_vhost/1, get_user/1]).
@@ -415,6 +419,14 @@ refresh_interceptors() ->
415419
ready_for_close(Pid) ->
416420
rabbit_channel_common:ready_for_close(Pid).
417421

422+
<<<<<<< HEAD
423+
=======
424+
-spec force_event_refresh(reference()) -> 'ok'.
425+
426+
% Note: https://www.pivotaltracker.com/story/show/166962656
427+
% This event is necessary for the stats timer to be initialized with
428+
% the correct values once the management agent has started
429+
>>>>>>> c93c3cc14... Merge pull request #2049 from rabbitmq/pt-166962656-stats-failure-38-lre
418430
force_event_refresh(Ref) ->
419431
[gen_server2:cast(C, {force_event_refresh, Ref}) || C <- list()],
420432
ok.
@@ -650,6 +662,9 @@ handle_cast({send_drained, CTagCredit}, State = #ch{writer_pid = WriterPid}) ->
650662
|| {ConsumerTag, CreditDrained} <- CTagCredit],
651663
noreply(State);
652664

665+
% Note: https://www.pivotaltracker.com/story/show/166962656
666+
% This event is necessary for the stats timer to be initialized with
667+
% the correct values once the management agent has started
653668
handle_cast({force_event_refresh, Ref}, State) ->
654669
rabbit_event:notify(channel_created, infos(?CREATION_EVENT_KEYS, State),
655670
Ref),

src/rabbit_reader.erl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ info(Pid, Items) ->
217217
{error, Error} -> throw(Error)
218218
end.
219219

220+
-spec force_event_refresh(pid(), reference()) -> 'ok'.
221+
222+
% Note: https://www.pivotaltracker.com/story/show/166962656
223+
% This event is necessary for the stats timer to be initialized with
224+
% the correct values once the management agent has started
220225
force_event_refresh(Pid, Ref) ->
221226
gen_server:cast(Pid, {force_event_refresh, Ref}).
222227

0 commit comments

Comments
 (0)