summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_exchange.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl
index ea364d2fb6..8171803906 100644
--- a/src/rabbit_exchange.erl
+++ b/src/rabbit_exchange.erl
@@ -270,10 +270,15 @@ has_bindings(ExchangeName) ->
MatchHead = #route{binding = #binding{exchange_name = ExchangeName,
queue_name = '$1',
key = '_'}},
- case mnesia:select(route, [{MatchHead, [], ['$1']}], 2, read) of
+ continue(fun() ->
+ mnesia:select(route, [{MatchHead, [], ['$1']}], 1, read)
+ end).
+
+continue(Fun) ->
+ case Fun() of
'$end_of_table' -> false;
- {[], _} -> false;
- _ -> true
+ {[], Cont} -> continue(fun() -> mnesia:select(Cont) end);
+ _ -> true
end.
call_with_exchange(Exchange, Fun) ->