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 | 5e24c7bd6b764858213bbc2dfb1e303b801b5fd3 (patch) | |
| tree | 434cfe5c72fc9945d736fd9b9350d1a406348965 /src | |
| parent | b003c245d5f4c67325cf5d5b46eef81cb412b02b (diff) | |
| download | rabbitmq-server-git-5e24c7bd6b764858213bbc2dfb1e303b801b5fd3.tar.gz | |
Minor refactoring of the continuation
Diffstat (limited to 'src')
| -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 bfd470396b..2f364a1b75 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. |
