diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2011-09-15 16:55:20 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2011-09-15 16:55:20 +0100 |
commit | 003197e2abef80a31c8008fe5419b2572d4c0037 (patch) | |
tree | fec377377b7dced10c7b639b466f59718a29bab1 | |
parent | aeb39f0c02992d4a965c13ae4ffbf5a915ede20c (diff) | |
download | rabbitmq-server-003197e2abef80a31c8008fe5419b2572d4c0037.tar.gz |
And now it's like well beautiful. Wicked.bug24428
-rw-r--r-- | src/rabbit_binding.erl | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl index 84f3a3ec..43c26941 100644 --- a/src/rabbit_binding.erl +++ b/src/rabbit_binding.erl @@ -122,31 +122,26 @@ recover_semi_durable_route(Gatherer, R = #route{binding = B}, ToRecover) -> true -> {ok, X} = rabbit_exchange:lookup(Src), ok = gatherer:fork(Gatherer), ok = worker_pool:submit_async( - recover_semi_durable_route_txn_fun(Gatherer, R, X)); + fun () -> + recover_semi_durable_route_txn(R, X), + gatherer:finish(Gatherer) + end); false -> ok end. -recover_semi_durable_route_txn_fun(Gatherer, R = #route{binding = B}, X) -> - fun () -> - rabbit_misc:execute_mnesia_transaction( - fun () -> - case [] =/= mnesia:match_object( - rabbit_semi_durable_route, R, read) of - false -> no_recover; - true -> ok = sync_transient_route( - R, fun mnesia:write/3), - rabbit_exchange:serial(X) - end - end, - fun (no_recover, _) -> - ok; - (_Serial, true) -> - x_callback(transaction, X, add_binding, B); - (Serial, false) -> - x_callback(Serial, X, add_binding, B) - end), - ok = gatherer:finish(Gatherer) - end. +recover_semi_durable_route_txn(R = #route{binding = B}, X) -> + rabbit_misc:execute_mnesia_transaction( + fun () -> + case mnesia:match_object(rabbit_semi_durable_route, R, read) of + [] -> no_recover; + _ -> ok = sync_transient_route(R, fun mnesia:write/3), + rabbit_exchange:serial(X) + end + end, + fun (no_recover, _) -> ok; + (_Serial, true) -> x_callback(transaction, X, add_binding, B); + (Serial, false) -> x_callback(Serial, X, add_binding, B) + end). exists(Binding) -> binding_action( |