summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2010-04-30 13:28:53 +0100
committerMatthew Sackman <matthew@lshift.net>2010-04-30 13:28:53 +0100
commit8ff0007d52838870cf31133a51529b4b9a13cf4f (patch)
tree2a17d6c7010d739d58b3659625b3b00f572c864f /src
parent2c9320f061a83adca550597f2a69afb698efe331 (diff)
downloadrabbitmq-server-git-8ff0007d52838870cf31133a51529b4b9a13cf4f.tar.gz
reduce_timer_set => timer_ref
Diffstat (limited to 'src')
-rw-r--r--src/file_handle_cache.erl20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl
index 7d96b66f22..3d944636de 100644
--- a/src/file_handle_cache.erl
+++ b/src/file_handle_cache.erl
@@ -171,7 +171,7 @@
count,
obtains,
callbacks_mrefs,
- reduce_timer_set
+ timer_ref
}).
%%----------------------------------------------------------------------------
@@ -700,7 +700,7 @@ init([]) ->
error_logger:info_msg("Limiting to approx ~p file handles~n", [Limit]),
{ok, #fhc_state { elders = dict:new(), limit = Limit, count = 0,
obtains = [], callbacks_mrefs = dict:new(),
- reduce_timer_set = false }}.
+ timer_ref = undefined }}.
handle_call(obtain, From, State = #fhc_state { count = Count }) ->
State1 = #fhc_state { count = Count1, limit = Limit, obtains = Obtains } =
@@ -745,7 +745,7 @@ handle_cast({close, Pid, EldestUnusedSince}, State =
count = Count - 1 }))};
handle_cast(check_counts, State) ->
- {noreply, maybe_reduce(State #fhc_state { reduce_timer_set = false })};
+ {noreply, maybe_reduce(State #fhc_state { timer_ref = undefined })};
handle_cast({release_on_death, Pid}, State) ->
_MRef = erlang:monitor(process, Pid),
@@ -790,7 +790,7 @@ process_obtains(State = #fhc_state { limit = Limit, count = Count,
maybe_reduce(State = #fhc_state {
limit = Limit, count = Count, elders = Elders,
- callbacks_mrefs = CallsMRefs, reduce_timer_set = TimerSet })
+ callbacks_mrefs = CallsMRefs, timer_ref = TRef })
when Limit /= infinity andalso Count >= Limit ->
Now = now(),
{Pids, Sum, ClientCount} =
@@ -813,12 +813,12 @@ maybe_reduce(State = #fhc_state {
end
end, Pids)
end,
- case TimerSet of
- true -> State;
- false -> {ok, _TRef} = timer:apply_after(
- ?FILE_HANDLES_CHECK_INTERVAL,
- gen_server, cast, [?SERVER, check_counts]),
- State #fhc_state { reduce_timer_set = true }
+ case TRef of
+ undefined -> {ok, TRef1} = timer:apply_after(
+ ?FILE_HANDLES_CHECK_INTERVAL,
+ gen_server, cast, [?SERVER, check_counts]),
+ State #fhc_state { timer_ref = TRef1 };
+ _ -> State
end;
maybe_reduce(State) ->
State.