diff options
author | Ben Hood <0x6e6562@gmail.com> | 2008-10-05 18:53:41 +0100 |
---|---|---|
committer | Ben Hood <0x6e6562@gmail.com> | 2008-10-05 18:53:41 +0100 |
commit | 20ce4be565391ef600311c32f736c00e2519645c (patch) | |
tree | 434cfe5c72fc9945d736fd9b9350d1a406348965 | |
parent | 87262ced6866eeb2c62a26949824140861d73f71 (diff) | |
download | rabbitmq-server-20ce4be565391ef600311c32f736c00e2519645c.tar.gz |
Minor refactoring of the continuation
-rw-r--r-- | src/rabbit_exchange.erl | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl index bfd47039..2f364a1b 100644 --- a/src/rabbit_exchange.erl +++ b/src/rabbit_exchange.erl @@ -262,22 +262,16 @@ has_bindings(ExchangeName, Predicate) -> MatchHead = #route{binding = #binding{exchange_name = ExchangeName, queue_name = '$1', key = '_'}}, - case mnesia:select(route, - [{MatchHead, [], ['$1']}], ?CHUNK_SIZE, write) of - '$end_of_table' -> ok; - {Routes, Continuation} -> - case lists:dropwhile(Predicate, Routes) of - [] -> continue(Continuation, Predicate); - _ -> true - end - end. + continue(fun() -> mnesia:select(route, + [{MatchHead, [], ['$1']}], ?CHUNK_SIZE, write) + end, Predicate). -continue(Continuation, Predicate) -> - case mnesia:select(Continuation) of +continue(Fun, Predicate) -> + case Fun() of '$end_of_table' -> false; {Routes, Cont} -> case lists:dropwhile(Predicate, Routes) of - [] -> continue(Cont, Predicate); + [] -> continue(fun() -> mnesia:select(Cont) end, Predicate); _ -> true end end. |