diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2013-12-05 18:23:11 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2013-12-05 18:23:11 +0000 |
commit | 549a9ca6b3da26d68e13bcfdb628039b5e0b2117 (patch) | |
tree | ce65f5e6d7f1e5e3da7a90331fdd3b6ba45ab789 | |
parent | ee9e3cb4ff6bc802f03f56e40234e11044f66c7a (diff) | |
download | rabbitmq-server-549a9ca6b3da26d68e13bcfdb628039b5e0b2117.tar.gz |
Make sure that our last event before going sorta-idle is not one in which we claim to be in flow control.
-rw-r--r-- | src/rabbit_reader.erl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index e00732fd..2c19b2bf 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -1073,8 +1073,16 @@ maybe_emit_stats(State) -> fun() -> emit_stats(State) end). emit_stats(State) -> - rabbit_event:notify(connection_stats, infos(?STATISTICS_KEYS, State)), - rabbit_event:reset_stats_timer(State, #v1.stats_timer). + Infos = infos(?STATISTICS_KEYS, State), + rabbit_event:notify(connection_stats, Infos), + State1 = rabbit_event:reset_stats_timer(State, #v1.stats_timer), + %% If we emit an event which looks like we are in flow control, it's not a + %% good idea for it to be our last even if we go idle. Keep emitting + %% events, either we stay busy or we drop out of flow control. + case proplists:get_value(last_blocked_age, Infos) < 5 of + true -> ensure_stats_timer(State1); + _ -> State1 + end. %% 1.0 stub -ifdef(use_specs). |