diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2011-04-06 15:44:56 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2011-04-06 15:44:56 +0100 |
| commit | 91b811add533c89c24a59b181e51dd279b4c0ed5 (patch) | |
| tree | 8c249231224ae972433b1472f6d41b6ebe10ba1f | |
| parent | d6d333829e5a087e58f927ee8bd0a71d78a5349b (diff) | |
| download | rabbitmq-server-git-91b811add533c89c24a59b181e51dd279b4c0ed5.tar.gz | |
Matthias prefers this.
| -rw-r--r-- | src/rabbit_binding.erl | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl index 2ae7c973c4..e02427bc5f 100644 --- a/src/rabbit_binding.erl +++ b/src/rabbit_binding.erl @@ -98,8 +98,16 @@ recover(XNames, QNames) -> XNameSet = sets:from_list(XNames), QNameSet = sets:from_list(QNames), rabbit_misc:table_fold( - fun (Route = #route{binding = B}, _Acc) -> - case should_recover(B, XNameSet, QNameSet) of + fun (Route = #route{binding = B = + #binding{destination = Dst = + #resource{kind = Kind}}}, _Acc) -> + %% The check against rabbit_durable_route is in case it + %% disappeared between getting the list and here + case (not mnesia:read({rabbit_durable_route, B}) =:= [] andalso + sets:is_element(Dst, case Kind of + exchange -> XNameSet; + queue -> QNameSet + end)) of true -> ok = sync_transient_binding( Route, fun mnesia:write/3), B; @@ -115,16 +123,6 @@ recover(XNames, QNames) -> none, rabbit_durable_route), ok. -should_recover(B = #binding{destination = Dst = #resource{ kind = Kind }}, - XNameSet, QNameSet) -> - case mnesia:read({rabbit_durable_route, B}) of - [] -> false; %% It disappeared between getting the list and here - [_] -> sets:is_element(Dst, case Kind of - exchange -> XNameSet; - queue -> QNameSet - end) - end. - exists(Binding) -> binding_action( Binding, fun (_Src, _Dst, B) -> |
