Skip to content

Commit 36aa94a

Browse files
authored
Merge pull request #12065 from rabbitmq/list-exchange-names-from-khepri-projection
rabbit_db_exchange: List exchange names from Khepri projection
2 parents 6394413 + 20f2850 commit 36aa94a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

deps/rabbit/src/rabbit_db_exchange.erl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,13 @@ list_in_mnesia() ->
151151
mnesia:dirty_all_keys(?MNESIA_TABLE).
152152

153153
list_in_khepri() ->
154-
case rabbit_khepri:match(khepri_exchanges_path() ++
155-
[rabbit_khepri:if_has_data_wildcard()]) of
156-
{ok, Map} ->
157-
maps:fold(fun(_K, X, Acc) -> [X#exchange.name | Acc] end, [], Map);
158-
_ ->
154+
try
155+
ets:foldr(
156+
fun(#exchange{name = Name}, Acc) ->
157+
[Name | Acc]
158+
end, [], ?KHEPRI_PROJECTION)
159+
catch
160+
error:badarg ->
159161
[]
160162
end.
161163

0 commit comments

Comments
 (0)