Skip to content

Commit f4a893e

Browse files
Filter duplicate default exchange binding in rabbit_binding:list_for_destination/1
Follow-up to #1833. Note that #1721/master don't do it because there the default exchange bindings are deleted at schema migration time.
1 parent f4b5fb4 commit f4a893e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/rabbit_binding.erl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,17 +274,20 @@ list_for_source(SrcName) ->
274274
<- mnesia:match_object(rabbit_route, Route, read)]
275275
end).
276276

277-
list_for_destination(DstName) ->
278-
implicit_for_destination(DstName) ++
279-
mnesia:async_dirty(
277+
list_for_destination(DstName = #resource{virtual_host = VHostPath}) ->
278+
AllBindings = mnesia:async_dirty(
280279
fun() ->
281280
Route = #route{binding = #binding{destination = DstName,
282281
_ = '_'}},
283282
[reverse_binding(B) ||
284283
#reverse_route{reverse_binding = B} <-
285284
mnesia:match_object(rabbit_reverse_route,
286285
reverse_route(Route), read)]
287-
end).
286+
end),
287+
Filtered = lists:filter(fun(#binding{source = S}) ->
288+
S =/= ?DEFAULT_EXCHANGE(VHostPath)
289+
end, AllBindings),
290+
implicit_for_destination(DstName) ++ Filtered.
288291

289292
implicit_bindings(VHostPath) ->
290293
DstQueues = rabbit_amqqueue:list_names(VHostPath),

0 commit comments

Comments
 (0)