@@ -199,6 +199,8 @@ handle_call({unregister_consumer,
199
199
{value , Consumer } ->
200
200
rabbit_log :debug (" Unregistering consumer ~p from group" ,
201
201
[Consumer ]),
202
+ {value , ActiveInPreviousGroupInstance } =
203
+ lookup_active_consumer (Group0 ),
202
204
G1 = remove_from_group (Consumer , Group0 ),
203
205
rabbit_log :debug (" Consumer removed from group: ~p " ,
204
206
[G1 ]),
@@ -212,7 +214,14 @@ handle_call({unregister_consumer,
212
214
false ->
213
215
undefined
214
216
end ,
215
- notify_consumers (undefined , NewActive , G2 ),
217
+ AIPGI =
218
+ case ActiveInPreviousGroupInstance of
219
+ Consumer ->
220
+ undefined ;
221
+ _ ->
222
+ ActiveInPreviousGroupInstance
223
+ end ,
224
+ notify_consumers (AIPGI , NewActive , G2 ),
216
225
G2 ;
217
226
false ->
218
227
rabbit_log :debug (" Could not find consumer ~p ~p in group ~p ~p ~p " ,
@@ -334,6 +343,10 @@ notify_consumers(undefined,
334
343
! {sac ,
335
344
{{subscription_id , SubscriptionId }, {active , true },
336
345
{side_effects , []}}};
346
+ notify_consumers (ActiveInPreviousGroupInstance , NewActive , _Group )
347
+ when ActiveInPreviousGroupInstance == NewActive ->
348
+ % % no changes (e.g. on unsubscription), nothing to do.
349
+ ok ;
337
350
notify_consumers (# consumer {pid = FormerConnPid ,
338
351
subscription_id = FormerSubId },
339
352
# consumer {pid = NewConnPid ,
0 commit comments