Skip to content

Commit 20f2850

Browse files
committed
rabbit_db_exchange: List exchange names from Khepri projection
[Why] All other queries are based on projections, not direct queries to Khepri. Using projections for exchange names should be faster and more consistent with the rest of the module. [How] The Khepri query is replaced by an ETS query.
1 parent 4a3fa4d commit 20f2850

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)