diff options
| author | Michael Klishin <mklishin@pivotal.io> | 2015-04-30 20:31:00 +0300 |
|---|---|---|
| committer | Michael Klishin <mklishin@pivotal.io> | 2015-04-30 20:31:00 +0300 |
| commit | 134771351b6894c2f314d3731f223537bf72a8c3 (patch) | |
| tree | 88208c9b52e7a367747a4c6cf73274d3587c6c71 | |
| parent | c29a33fd39822623ef5743439ffbe1f393bff3d3 (diff) | |
| download | rabbitmq-server-git-134771351b6894c2f314d3731f223537bf72a8c3.tar.gz | |
Use os:timestamp/1 instead of erlang:now/0 in credit_flow and rabbit_reader
Fixes #135.
| -rw-r--r-- | src/credit_flow.erl | 4 | ||||
| -rw-r--r-- | src/rabbit_reader.erl | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/credit_flow.erl b/src/credit_flow.erl index 8932062145..fc233b87c3 100644 --- a/src/credit_flow.erl +++ b/src/credit_flow.erl @@ -116,7 +116,7 @@ state() -> case blocked() of true -> flow; false -> case get(credit_blocked_at) of undefined -> running; - B -> Diff = timer:now_diff(erlang:now(), B), + B -> Diff = timer:now_diff(os:timestamp(), B), case Diff < 5000000 of true -> flow; false -> running @@ -144,7 +144,7 @@ grant(To, Quantity) -> block(From) -> case blocked() of - false -> put(credit_blocked_at, erlang:now()); + false -> put(credit_blocked_at, os:timestamp()); true -> ok end, ?UPDATE(credit_blocked, [], Blocks, [From | Blocks]). diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index e3247439ef..6d4b1b7a69 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -490,7 +490,7 @@ maybe_block(State = #v1{connection_state = blocking, State1 = State#v1{connection_state = blocked, throttle = update_last_blocked_by( Throttle#throttle{ - last_blocked_at = erlang:now()})}, + last_blocked_at = os:timestamp()})}, case {blocked_by_alarm(State), blocked_by_alarm(State1)} of {false, true} -> ok = send_blocked(State1); {_, _} -> ok @@ -1176,7 +1176,7 @@ i(state, #v1{connection_state = ConnectionState, (credit_flow:blocked() %% throttled by flow now orelse %% throttled by flow recently (WasBlockedBy =:= flow andalso T =/= never andalso - timer:now_diff(erlang:now(), T) < 5000000)) of + timer:now_diff(os:timestamp(), T) < 5000000)) of true -> flow; false -> ConnectionState end; |
