@@ -411,7 +411,7 @@ delete_in_khepri(QueueName, OnlyDurable) ->
411
411
fun () ->
412
412
Path = khepri_queue_path (QueueName ),
413
413
case khepri_tx_adv :delete (Path ) of
414
- {ok , #{data := _ }} ->
414
+ {ok , #{Path : = #{ data := _ } }} ->
415
415
% % we want to execute some things, as decided by rabbit_exchange,
416
416
% % after the transaction.
417
417
rabbit_db_binding :delete_for_destination_in_khepri (QueueName , OnlyDurable );
@@ -606,7 +606,7 @@ update_in_khepri(QName, Fun) ->
606
606
Path = khepri_queue_path (QName ),
607
607
Ret1 = rabbit_khepri :adv_get (Path ),
608
608
case Ret1 of
609
- {ok , #{data := Q , payload_version := Vsn }} ->
609
+ {ok , #{Path : = #{ data := Q , payload_version := Vsn } }} ->
610
610
UpdatePath = khepri_path :combine_with_conditions (
611
611
Path , [# if_payload_version {version = Vsn }]),
612
612
Q1 = Fun (Q ),
@@ -657,7 +657,7 @@ update_decorators_in_khepri(QName, Decorators) ->
657
657
Path = khepri_queue_path (QName ),
658
658
Ret1 = rabbit_khepri :adv_get (Path ),
659
659
case Ret1 of
660
- {ok , #{data := Q1 , payload_version := Vsn }} ->
660
+ {ok , #{Path : = #{ data := Q1 , payload_version := Vsn } }} ->
661
661
Q2 = amqqueue :set_decorators (Q1 , Decorators ),
662
662
UpdatePath = khepri_path :combine_with_conditions (
663
663
Path , [# if_payload_version {version = Vsn }]),
@@ -1075,15 +1075,12 @@ delete_transient_in_khepri(FilterFun) ->
1075
1075
case rabbit_khepri :adv_get_many (PathPattern ) of
1076
1076
{ok , Props } ->
1077
1077
Qs = maps :fold (
1078
- fun (Path0 , #{data := Q , payload_version := Vsn }, Acc )
1078
+ fun (Path , #{data := Q , payload_version := Vsn }, Acc )
1079
1079
when ? is_amqqueue (Q ) ->
1080
1080
case FilterFun (Q ) of
1081
1081
true ->
1082
- Path = khepri_path :combine_with_conditions (
1083
- Path0 ,
1084
- [# if_payload_version {version = Vsn }]),
1085
1082
QName = amqqueue :get_name (Q ),
1086
- [{Path , QName } | Acc ];
1083
+ [{Path , Vsn , QName } | Acc ];
1087
1084
false ->
1088
1085
Acc
1089
1086
end
@@ -1102,20 +1099,7 @@ do_delete_transient_queues_in_khepri([], _FilterFun) ->
1102
1099
do_delete_transient_queues_in_khepri (Qs , FilterFun ) ->
1103
1100
Res = rabbit_khepri :transaction (
1104
1101
fun () ->
1105
- rabbit_misc :fold_while_ok (
1106
- fun ({Path , QName }, Acc ) ->
1107
- % % Also see `delete_in_khepri/2'.
1108
- case khepri_tx_adv :delete (Path ) of
1109
- {ok , #{data := _ }} ->
1110
- Deletions = rabbit_db_binding :delete_for_destination_in_khepri (
1111
- QName , false ),
1112
- {ok , [{QName , Deletions } | Acc ]};
1113
- {ok , _ } ->
1114
- {ok , Acc };
1115
- {error , _ } = Error ->
1116
- Error
1117
- end
1118
- end , [], Qs )
1102
+ do_delete_transient_queues_in_khepri_tx (Qs , [])
1119
1103
end ),
1120
1104
case Res of
1121
1105
{ok , Items } ->
@@ -1129,6 +1113,24 @@ do_delete_transient_queues_in_khepri(Qs, FilterFun) ->
1129
1113
Error
1130
1114
end .
1131
1115
1116
+ do_delete_transient_queues_in_khepri_tx ([], Acc ) ->
1117
+ {ok , Acc };
1118
+ do_delete_transient_queues_in_khepri_tx ([{Path , Vsn , QName } | Rest ], Acc ) ->
1119
+ % % Also see `delete_in_khepri/2'.
1120
+ VersionedPath = khepri_path :combine_with_conditions (
1121
+ Path , [# if_payload_version {version = Vsn }]),
1122
+ case khepri_tx_adv :delete (VersionedPath ) of
1123
+ {ok , #{Path := #{data := _ }}} ->
1124
+ Deletions = rabbit_db_binding :delete_for_destination_in_khepri (
1125
+ QName , false ),
1126
+ Acc1 = [{QName , Deletions } | Acc ],
1127
+ do_delete_transient_queues_in_khepri_tx (Rest , Acc1 );
1128
+ {ok , _ } ->
1129
+ do_delete_transient_queues_in_khepri_tx (Rest , Acc );
1130
+ {error , _ } = Error ->
1131
+ Error
1132
+ end .
1133
+
1132
1134
% % -------------------------------------------------------------------
1133
1135
% % foreach_transient().
1134
1136
% % -------------------------------------------------------------------
0 commit comments