Skip to content

Commit c2f43dc

Browse files
committed
Handle {error, not_found} case when recovering a binding
A customer could not recover a vhost due to the following error: ``` [error] <0.32570.2> Unable to recover vhost <<"/">> data. Reason {badmatch,{error,not_found}} [error] <0.32570.2> Stacktrace [{rabbit_binding,recover_semi_durable_route,3, [error] <0.32570.2> [{file,"rabbit_binding.erl"},{line,113}]}, [error] <0.32570.2> {rabbit_binding,'-recover/2-lc$^1/1-1-',3, [error] <0.32570.2> [{file,"rabbit_binding.erl"},{line,103}]}, [error] <0.32570.2> {rabbit_binding,recover,2, [error] <0.32570.2> [{file,"rabbit_binding.erl"},{line,104}]}, ``` Reference: https://vmware.slack.com/archives/C0RDGG81Z/p1698140367947859
1 parent 83bfce8 commit c2f43dc

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

deps/rabbit/src/rabbit_binding.erl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,17 @@ 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} -> ok
113+
end;
110114
false -> ok
111115
end.
112116

0 commit comments

Comments
 (0)