diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2010-08-22 15:26:36 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2010-08-22 15:26:36 +0100 |
commit | 34726900bf50d13cbe3eec78af95d4dda95a1712 (patch) | |
tree | 41b2a8950f5a07d4ec1bb45f8e75317fef08daef | |
parent | 86dc2c12bda1068c3b264f96b06d1c6b550a30b7 (diff) | |
download | rabbitmq-server-34726900bf50d13cbe3eec78af95d4dda95a1712.tar.gz |
always leave at least two fds unobtainable
so that 'copy' can succeed
Also, zero-clamp obtain limit
-rw-r--r-- | src/file_handle_cache.erl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl index 3580439e..24c4d3a8 100644 --- a/src/file_handle_cache.erl +++ b/src/file_handle_cache.erl @@ -148,7 +148,7 @@ -define(FILE_HANDLES_LIMIT_OTHER, 1024). -define(FILE_HANDLES_CHECK_INTERVAL, 2000). --define(OBTAIN_LIMIT(LIMIT), trunc((LIMIT * 0.9) - 1)). +-define(OBTAIN_LIMIT(LIMIT), trunc((LIMIT * 0.9) - 2)). -define(CLIENT_ETS_TABLE, ?MODULE). %%---------------------------------------------------------------------------- @@ -953,7 +953,10 @@ pending_is_empty({_N, _Queue}) -> %%---------------------------------------------------------------------------- obtain_limit(infinity) -> infinity; -obtain_limit(Limit) -> ?OBTAIN_LIMIT(Limit). +obtain_limit(Limit) -> case ?OBTAIN_LIMIT(Limit) of + OLimit when OLimit < 0 -> 0; + OLimit -> OLimit + end. requested({_Kind, _Pid, Requested, _From}) -> Requested. |