summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Mazzoli <francesco@rabbitmq.com>2012-02-22 15:35:10 +0000
committerFrancesco Mazzoli <francesco@rabbitmq.com>2012-02-22 15:35:10 +0000
commit1a2ea0daa42e5f8265626755679be81a571144cb (patch)
tree6742fb3bfd02b3fd7dae7feb6f08d01f3958d47f
parent10394f9c082b2c2e8a9ff733b4240bd86c3e993e (diff)
downloadrabbitmq-server-git-1a2ea0daa42e5f8265626755679be81a571144cb.tar.gz
Checking for memory usage in needs_timeout
-rw-r--r--src/rabbit_variable_queue.erl16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index a4d18b50ff..28b7830e7d 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 }) ->