summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hood <0x6e6562@gmail.com>2008-10-06 11:48:22 +0100
committerBen Hood <0x6e6562@gmail.com>2008-10-06 11:48:22 +0100
commit694930845bab1654412e49cca14d7b94488b951d (patch)
tree1e93c25298d60dcf15e15343ab7bac93b24da188
parentff26177ec09b2220183d410c61f258880c130a77 (diff)
downloadrabbitmq-server-694930845bab1654412e49cca14d7b94488b951d.tar.gz
Factored out re-entry condition
-rw-r--r--src/rabbit_exchange.erl15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl
index 5e4702f9..82534354 100644
--- a/src/rabbit_exchange.erl
+++ b/src/rabbit_exchange.erl
@@ -234,9 +234,7 @@ delete_bindings(Binding = #binding{exchange_name = X,
case has_bindings(ExchangeName, Predicate) of
true -> ok;
false ->
- % TODO: This re-enters the delete_bindings
- % function unecessessarily
- do_internal_delete(ExchangeName)
+ unchecked_internal_delete(ExchangeName)
end;
true -> ok
end
@@ -427,9 +425,6 @@ internal_delete(ExchangeName, _IfUnused = true) ->
internal_delete(ExchangeName, false) ->
do_internal_delete(ExchangeName).
-% TODO: Think about an optional do_internal_delete that takes an Exchange
-% instead of an Exchange, i.e. something that has already done the lookup
-% already, e.g. delete_bindings/1
do_internal_delete(ExchangeName) ->
case mnesia:wread({exchange, ExchangeName}) of
[] -> {error, not_found};
@@ -437,6 +432,10 @@ do_internal_delete(ExchangeName) ->
delete_bindings(#binding{exchange_name = ExchangeName,
queue_name = '_',
key = '_'}),
- ok = mnesia:delete({durable_exchanges, ExchangeName}),
- ok = mnesia:delete({exchange, ExchangeName})
+ unchecked_internal_delete(ExchangeName)
end.
+
+unchecked_internal_delete(ExchangeName) ->
+ ok = mnesia:delete({durable_exchanges, ExchangeName}),
+ ok = mnesia:delete({exchange, ExchangeName}).
+