summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Klishin <mklishin@pivotal.io>2015-05-07 15:28:18 +0300
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-05-07 16:57:24 +0200
commit7710829844feecee3acb102f50e7202d3aed768e (patch)
tree705992fbcb0949bde3fbf8e1b5207c7f2a0bcb79 /src
parent18fcb1a9c793ac2530fa3b73b63092499120d1f0 (diff)
downloadrabbitmq-server-git-7710829844feecee3acb102f50e7202d3aed768e.tar.gz
Make credit flow state transition interval 1s instead of 5s
Management UI and HTTP API currently report connections and channels as in flow if they've been in flow for the last 5 seconds. That can confuse the user with inter-node flow control, making them believe the flow is permanent (it is not: the actual state toggles many times a second). This reduces the interval to 1s, which seems more reasonable and accurate (in a way). Fixes #138.
Diffstat (limited to 'src')
-rw-r--r--src/credit_flow.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/credit_flow.erl b/src/credit_flow.erl
index 8932062145..ab54b82335 100644
--- a/src/credit_flow.erl
+++ b/src/credit_flow.erl
@@ -68,6 +68,11 @@
put(Key, Expr)
end).
+%% If current process was blocked by credit flow in the last
+%% STATE_CHANGE_INTERVAL milliseconds, state/0 will report it as "in
+%% flow".
+-define(STATE_CHANGE_INTERVAL, 1000000).
+
%%----------------------------------------------------------------------------
%% There are two "flows" here; of messages and of credit, going in
@@ -117,7 +122,7 @@ state() -> case blocked() of
false -> case get(credit_blocked_at) of
undefined -> running;
B -> Diff = timer:now_diff(erlang:now(), B),
- case Diff < 5000000 of
+ case Diff < ?STATE_CHANGE_INTERVAL of
true -> flow;
false -> running
end