diff options
author | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-02-22 15:35:10 +0000 |
---|---|---|
committer | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-02-22 15:35:10 +0000 |
commit | 31207ed9ebb885f1143f22d8c2a7a1048b4b1292 (patch) | |
tree | 6742fb3bfd02b3fd7dae7feb6f08d01f3958d47f | |
parent | 9d0cca53e3422f74f85e681785228a6c09dae024 (diff) | |
download | rabbitmq-server-31207ed9ebb885f1143f22d8c2a7a1048b4b1292.tar.gz |
Checking for memory usage in needs_timeout
-rw-r--r-- | src/rabbit_variable_queue.erl | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index a4d18b50..28b7830e 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -734,10 +734,18 @@ ram_duration(State = #vqstate { needs_timeout(State = #vqstate { index_state = IndexState }) -> case needs_index_sync(State) of true -> timed; - false -> case rabbit_queue_index:needs_sync(IndexState) of - true -> idle; - false -> false - end + false -> + case rabbit_queue_index:needs_sync(IndexState) of + true -> idle; + false -> case reduce_memory_use( + fun (_Quota, State1) -> {0, State1} end, + fun (_Quota, State1) -> State1 end, + fun (_Quota, State1) -> {0, State1} end, + State) of + {true, _State} -> idle; + {false, _State} -> false + end + end end. timeout(State = #vqstate { index_state = IndexState }) -> |