Skip to content

Commit 4f8ce90

Browse files
author
Simon MacMullen
committed
Merge bug25899
2 parents fadc9f3 + 3f48840 commit 4f8ce90

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/rabbit_reader.erl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,8 +1073,18 @@ maybe_emit_stats(State) ->
10731073
fun() -> emit_stats(State) end).
10741074

10751075
emit_stats(State) ->
1076-
rabbit_event:notify(connection_stats, infos(?STATISTICS_KEYS, State)),
1077-
rabbit_event:reset_stats_timer(State, #v1.stats_timer).
1076+
Infos = infos(?STATISTICS_KEYS, State),
1077+
rabbit_event:notify(connection_stats, Infos),
1078+
State1 = rabbit_event:reset_stats_timer(State, #v1.stats_timer),
1079+
%% If we emit an event which looks like we are in flow control, it's not a
1080+
%% good idea for it to be our last even if we go idle. Keep emitting
1081+
%% events, either we stay busy or we drop out of flow control.
1082+
%% The 5 is to match the test in formatters.js:fmt_connection_state().
1083+
%% This magic number will go away when bug 24829 is merged.
1084+
case proplists:get_value(last_blocked_age, Infos) < 5 of
1085+
true -> ensure_stats_timer(State1);
1086+
_ -> State1
1087+
end.
10781088

10791089
%% 1.0 stub
10801090
-ifdef(use_specs).

0 commit comments

Comments
 (0)