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 | cb2937e873e5fc2e2c7395edc0127e659177b705 (patch) | |
| tree | bcb8a1d2f3afbffef625932439309570d0a76638 | |
| parent | ae5d4a37cbb15d1899c7a2ceaabf24ac72aac76e (diff) | |
| download | rabbitmq-server-git-cb2937e873e5fc2e2c7395edc0127e659177b705.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 159442707a..d35ad1a6bf 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); |
