@@ -96,7 +96,7 @@ start_child(X) ->
96
96
97
97
child_exists (Name ) ->
98
98
Id = id (Name ),
99
- % % older format, pre 3.13.0
99
+ % % older format, pre- 3.13.0
100
100
OldId = old_id (Name ),
101
101
lists :any (fun ({ChildId , _ , _ , _ }) ->
102
102
ChildId =:= Id orelse ChildId =:= OldId
@@ -110,14 +110,9 @@ adjust({clear_upstream, VHost, UpstreamName}) ->
110
110
],
111
111
ok ;
112
112
adjust (Reason ) ->
113
- _ = [case Id of
114
- {_ , # exchange {} = X } ->
115
- rabbit_federation_link_sup :adjust (Pid , X , Reason );
116
- # exchange {} = X ->
117
- % % Old child id format, pre 3.13.0
118
- rabbit_federation_link_sup :adjust (Pid , X , Reason )
119
- end
120
- || {Id , Pid , _ , _ } <- mirrored_supervisor :which_children (? SUPERVISOR )],
113
+ _ = [rabbit_federation_link_sup :adjust (Pid , exchange_record_from_child_id (Id ), Reason ) ||
114
+ {Id , Pid , _ , _ } <- mirrored_supervisor :which_children (? SUPERVISOR )
115
+ ],
121
116
ok .
122
117
123
118
stop_child (X ) ->
@@ -127,10 +122,10 @@ stop_child(X) ->
127
122
{error , not_found } = Error ->
128
123
case rabbit_khepri :is_enabled () of
129
124
true ->
130
- % % Old id format is not supported by and cannot exist in Khepri
125
+ % % Old id format is not supported by Khepri and cannot exist there
131
126
Error ;
132
127
false ->
133
- % % try old format, pre 3.13.0
128
+ % % try old format, pre- 3.13.0
134
129
stop_and_delete_child (old_id (X ))
135
130
end
136
131
end ,
@@ -171,8 +166,10 @@ old_id(X = #exchange{policy = Policy}) ->
171
166
X1 = rabbit_exchange :immutable (X ),
172
167
X1 # exchange {policy = Policy }.
173
168
169
+ % % New child id format, introduced in 3.13.0 for Khepri
174
170
exchange_record_from_child_id ({_ , # exchange {} = XR }) ->
175
171
XR ;
172
+ % % Old child id format, pre-3.13.0
176
173
exchange_record_from_child_id (# exchange {} = XR ) ->
177
174
XR .
178
175
0 commit comments