diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2011-03-28 21:46:30 +0100 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2011-03-28 21:46:30 +0100 |
| commit | fe03a19d205359632c1c9ee72b8723dafc475ecf (patch) | |
| tree | 67f369007e4b73ca463d1b497357b20a7eac55c5 /src | |
| parent | 90f38d507ed6e63f5e358453319f67d816156199 (diff) | |
| download | rabbitmq-server-git-fe03a19d205359632c1c9ee72b8723dafc475ecf.tar.gz | |
only look up exchange type once
...and fix a bug in the XT:create invocation - the serial wasn't being
passed through.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_exchange.erl | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl index 7813db2a41..3bd667a583 100644 --- a/src/rabbit_exchange.erl +++ b/src/rabbit_exchange.erl @@ -113,8 +113,9 @@ declare(XName, Type, Durable, AutoDelete, Internal, Args) -> auto_delete = AutoDelete, internal = Internal, arguments = Args}, + XT = type_to_module(Type), %% We want to upset things if it isn't ok - ok = (type_to_module(Type)):validate(X), + ok = XT:validate(X), rabbit_misc:execute_mnesia_transaction( fun () -> case mnesia:wread({rabbit_exchange, XName}) of @@ -131,14 +132,13 @@ declare(XName, Type, Durable, AutoDelete, Internal, Args) -> end end, fun ({new, Exchange}, Tx) -> - S = case Tx of - true -> transaction; - false -> case serialise_events(Exchange) of - true -> 0; - false -> none - end - end, - ok = (type_to_module(Type)):create(Tx, Exchange), + ok = XT:create(case Tx of + true -> transaction; + false -> case XT:serialise_events() of + true -> 0; + false -> none + end + end, Exchange), rabbit_event:notify_if(not Tx, exchange_created, info(Exchange)), Exchange; ({existing, Exchange}, _Tx) -> |
