diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2011-01-18 08:49:38 +0000 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2011-01-18 08:49:38 +0000 |
| commit | 619b95d57bda575d1b639504d7623cf825cc5ba1 (patch) | |
| tree | 0c965608e5505b143cefbd73d221fc067cb5fde7 /src | |
| parent | 6b4fc02d61233cde5c9ca13f407270fff25b6db7 (diff) | |
| download | rabbitmq-server-git-619b95d57bda575d1b639504d7623cf825cc5ba1.tar.gz | |
small simplifying refactor
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_amqqueue.erl | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl index a16ef99709..9626e12617 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -212,27 +212,23 @@ declare(QueueName, Durable, AutoDelete, Args, Owner) -> Q1 -> Q1 end. -internal_declare(Q = #amqqueue{name = QueueName}, Recover) -> +internal_declare(Q, true) -> + rabbit_misc:execute_mnesia_tx_with_tail( + fun () -> ok = store_queue(Q), rabbit_misc:const(Q) end); +internal_declare(Q = #amqqueue{name = QueueName}, false) -> rabbit_misc:execute_mnesia_tx_with_tail( fun () -> - case Recover of - true -> - ok = store_queue(Q), - rabbit_misc:const(Q); - false -> - case mnesia:wread({rabbit_queue, QueueName}) of - [] -> - case mnesia:read({rabbit_durable_queue, - QueueName}) of - [] -> ok = store_queue(Q), - B = add_default_binding(Q), - fun (Tx) -> B(Tx), Q end; - [_] -> %% Q exists on stopped node - rabbit_misc:const(not_found) - end; - [ExistingQ] -> - rabbit_misc:const(ExistingQ) - end + case mnesia:wread({rabbit_queue, QueueName}) of + [] -> + case mnesia:read({rabbit_durable_queue, QueueName}) of + [] -> ok = store_queue(Q), + B = add_default_binding(Q), + fun (Tx) -> B(Tx), Q end; + [_] -> %% Q exists on stopped node + rabbit_misc:const(not_found) + end; + [ExistingQ] -> + rabbit_misc:const(ExistingQ) end end). |
