Skip to content

Commit a8a0dfe

Browse files
author
Simon MacMullen
committed
Make sure that our last event before going sorta-idle is not one in which we claim to be in flow control.
1 parent 0d52fab commit a8a0dfe

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/rabbit_reader.erl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,8 +1073,16 @@ 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+
case proplists:get_value(last_blocked_age, Infos) < 5 of
1083+
true -> ensure_stats_timer(State1);
1084+
_ -> State1
1085+
end.
10781086

10791087
%% 1.0 stub
10801088
-ifdef(use_specs).

0 commit comments

Comments
 (0)