diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-06-17 10:31:12 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-06-17 10:31:12 +0100 |
commit | 2b3729c6aeb3305de25a03c0b062c62df62450aa (patch) | |
tree | 6321dabfe47465147bfc9e9b3fd960aa920e9783 | |
parent | e0a5225cb21c47986e2546b67e344393bea6a519 (diff) | |
download | rabbitmq-server-bug26221.tar.gz |
Simplify.bug26221
-rw-r--r-- | src/rabbit_channel.erl | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index ee863a39..bb626554 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -992,12 +992,7 @@ handle_method(#'queue.declare'{queue = QueueNameBin, QueueName, fun (Q) -> ok = rabbit_amqqueue:assert_equivalence( Q, Durable, AutoDelete, Args, Owner), - case NoWait of - false -> - rabbit_amqqueue:stat(Q); - _ -> - {ok, 0, 0} - end + maybe_stat(NoWait, Q) end) of {ok, MessageCount, ConsumerCount} -> return_queue_declare_ok(QueueName, NoWait, MessageCount, @@ -1051,14 +1046,9 @@ handle_method(#'queue.declare'{queue = QueueNameBin, _, State = #ch{virtual_host = VHostPath, conn_pid = ConnPid}) -> QueueName = rabbit_misc:r(VHostPath, queue, QueueNameBin), - F = case NoWait of - false -> - fun (Q) -> {rabbit_amqqueue:stat(Q), Q} end; - true -> - fun (Q) -> {{ok, 0, 0}, Q} end - end, {{ok, MessageCount, ConsumerCount}, #amqqueue{} = Q} = - rabbit_amqqueue:with_or_die(QueueName, F), + rabbit_amqqueue:with_or_die( + QueueName, fun (Q) -> {maybe_stat(NoWait, Q), Q} end), ok = rabbit_amqqueue:check_exclusive_access(Q, ConnPid), return_queue_declare_ok(QueueName, NoWait, MessageCount, ConsumerCount, State); @@ -1214,6 +1204,9 @@ basic_consume(QueueName, NoAck, ConsumerPrefetch, ActualConsumerTag, E end. +maybe_stat(false, Q) -> rabbit_amqqueue:stat(Q); +maybe_stat(true, _Q) -> {ok, 0, 0}. + consumer_monitor(ConsumerTag, State = #ch{consumer_mapping = ConsumerMapping, queue_monitors = QMons, |