From 9473ebe9d4e94c91ad61a35485aad6a6555be57c Mon Sep 17 00:00:00 2001 From: Simon MacMullen Date: Fri, 28 Jun 2013 16:37:47 +0100 Subject: Oops --- src/priority_queue.erl | 1 + src/rabbit_amqqueue_process.erl | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1