diff options
author | Michael Klishin <michael@rabbitmq.com> | 2014-06-16 10:39:13 +0400 |
---|---|---|
committer | Michael Klishin <michael@rabbitmq.com> | 2014-06-16 10:39:13 +0400 |
commit | e488e880996be457068b84f9954ece05d08425aa (patch) | |
tree | bcb8a1d2f3afbffef625932439309570d0a76638 | |
parent | 3a35597189d6d96224501e34e405310dcd323712 (diff) | |
download | rabbitmq-server-e488e880996be457068b84f9954ece05d08425aa.tar.gz |
Don't stat() queue when it is declared with nowait = true
-rw-r--r-- | src/rabbit_channel.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 15944270..d35ad1a6 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -1046,9 +1046,14 @@ 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, fun (Q) -> {rabbit_amqqueue:stat(Q), Q} end), + rabbit_amqqueue:with_or_die(QueueName, F), ok = rabbit_amqqueue:check_exclusive_access(Q, ConnPid), return_queue_declare_ok(QueueName, NoWait, MessageCount, ConsumerCount, State); |