summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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