summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-06-28 16:37:47 +0100
committerSimon MacMullen <simon@rabbitmq.com>2013-06-28 16:37:47 +0100
commit9473ebe9d4e94c91ad61a35485aad6a6555be57c (patch)
treed71d03c93048efbc320d76e4b5ed834e4779a9ab
parenta9b9dc61e5aa4f0cbd04eb1de69d2e4540968a10 (diff)
downloadrabbitmq-server-9473ebe9d4e94c91ad61a35485aad6a6555be57c.tar.gz
Oops
-rw-r--r--src/priority_queue.erl1
-rw-r--r--src/rabbit_amqqueue_process.erl3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/priority_queue.erl b/src/priority_queue.erl
index 572bca95..8ded389b 100644
--- a/src/priority_queue.erl
+++ b/src/priority_queue.erl
@@ -212,6 +212,7 @@ fold(Fun, Init, Q) -> case out_p(Q) of
{{value, V, P}, Q1} -> fold(Fun, Fun(V, P, Init), Q1)
end.
+highest({queue, [], [], 0}) -> exit(highest_priority_of_empty_queue);
highest({queue, _, _, _}) -> 0;
highest({pqueue, [{P, _} | _]}) -> maybe_negate_priority(P).
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 60b56aeb..dc2a7a3f 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -550,7 +550,8 @@ notify_federation(#q{q = Q,
false -> rabbit_federation_queue:stop(Q)
end.
-active_unfederated(Cs) -> priority_queue:highest(Cs) >= 0.
+active_unfederated(Cs) ->
+ not priority_queue:is_empty(Cs) andalso priority_queue:highest(Cs) >= 0.
consumer_priority({_ChPid, #consumer{args = Args}}) ->
case rabbit_misc:table_lookup(Args, <<"x-priority">>) of