summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-12-06 11:32:21 +0000
committerSimon MacMullen <simon@rabbitmq.com>2013-12-06 11:32:21 +0000
commit0996612099bcc06235a0d1ab02abd7e91c11d2c4 (patch)
treeff38db7a39c95163853c743494a251e867d2609a /src
parent160092e8eab3b9e7eca59cf9ce30ca9f25fc1d5b (diff)
parent3f48840af18cd67cdf5888e6eaa827a537502840 (diff)
downloadrabbitmq-server-git-0996612099bcc06235a0d1ab02abd7e91c11d2c4.tar.gz
stable to default
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_reader.erl14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 2b33293de1..fe31a3e4db 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -1098,8 +1098,18 @@ 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.
+ %% The 5 is to match the test in formatters.js:fmt_connection_state().
+ %% This magic number will go away when bug 24829 is merged.
+ case proplists:get_value(last_blocked_age, Infos) < 5 of
+ true -> ensure_stats_timer(State1);
+ _ -> State1
+ end.
%% 1.0 stub
-ifdef(use_specs).