diff --git a/src/credit_flow.erl b/src/credit_flow.erl index 893206214564..ab54b823356f 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