diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2010-08-19 12:28:48 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2010-08-19 12:28:48 +0100 |
commit | 4efa0e92e8ab33daf9fc502e8cd036cee3019ce0 (patch) | |
tree | afb64f81f9750bd5a9789dea64851a1e54c5bd6f | |
parent | 2623dc7cd982614b754f0398c29010c2558824c5 (diff) | |
download | rabbitmq-server-bug23138.tar.gz |
once again allow use of fhc w/o registeringbug23138
-rw-r--r-- | src/file_handle_cache.erl | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl index e51ce921..dd693cb4 100644 --- a/src/file_handle_cache.erl +++ b/src/file_handle_cache.erl @@ -751,8 +751,9 @@ handle_call({open, Pid, EldestUnusedSince, CanClose}, From, elders = Elders }) -> Elders1 = dict:store(Pid, EldestUnusedSince, Elders), Item = {open, Pid, From}, - case maybe_reduce(State #fhc_state { open_count = Count + 1, - elders = Elders1 }) of + case maybe_reduce(ensure_mref(Pid, State #fhc_state { + open_count = Count + 1, + elders = Elders1 })) of {true, State1} -> State2 = State1 #fhc_state { open_count = Count }, case CanClose of @@ -933,8 +934,10 @@ maybe_reduce(State = #fhc_state { limit = Limit, _ -> AverageAge = Sum / ClientCount, lists:foreach( fun (Pid) -> - {M, F, A} = dict:fetch(Pid, Callbacks), - apply(M, F, A ++ [AverageAge]) + case dict:find(Pid, Callbacks) of + error -> ok; + {ok, {M, F, A}} -> apply(M, F, A ++ [AverageAge]) + end end, Pids) end, AboveLimit = Limit =/= infinity andalso OpenCount + ObtainCount > Limit, |