Skip to content

Commit 5c91495

Browse files
Merge pull request #9770 from rabbitmq/lukebakken/handle-possible-not_found-binding
Handle `{error, not_found}` case when recovering a binding
2 parents 69826d8 + 314f5b6 commit 5c91495

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

deps/rabbit/src/rabbit_binding.erl

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,21 @@ recover(XNames, QNames) ->
100100

101101
recover_semi_durable_route(Gatherer, Binding, Src, Dst, ToRecover, Fun) ->
102102
case sets:is_element(Dst, ToRecover) of
103-
true -> {ok, X} = rabbit_exchange:lookup(Src),
104-
ok = gatherer:fork(Gatherer),
105-
ok = worker_pool:submit_async(
106-
fun () ->
107-
Fun(Binding, X),
108-
gatherer:finish(Gatherer)
109-
end);
103+
true ->
104+
case rabbit_exchange:lookup(Src) of
105+
{ok, X} ->
106+
ok = gatherer:fork(Gatherer),
107+
ok = worker_pool:submit_async(
108+
fun () ->
109+
Fun(Binding, X),
110+
gatherer:finish(Gatherer)
111+
end);
112+
{error, not_found}=Error ->
113+
rabbit_log:warning(
114+
"expected exchange ~tp to exist during recovery, "
115+
"error: ~tp", [Src, Error]),
116+
ok
117+
end;
110118
false -> ok
111119
end.
112120

0 commit comments

Comments
 (0)