@@ -1529,9 +1529,12 @@ activate_next_consumer(#?STATE{consumers = Cons0,
15291529 State = State0 #? STATE {consumers = Cons ,
15301530 service_queue = ServiceQueue1 ,
15311531 waiting_consumers = Waiting },
1532+ Effects1 = consumer_update_active_effects (State , Active ,
1533+ false , waiting ,
1534+ Effects0 ),
15321535 Effects = consumer_update_active_effects (State , Consumer ,
15331536 true , single_active ,
1534- Effects0 ),
1537+ Effects1 ),
15351538 {State , Effects };
15361539 {{ActiveCKey , ? CONSUMER_PRIORITY (ActivePriority ) = Active },
15371540 {_NextCKey , ? CONSUMER_PRIORITY (WaitingPriority )}}
@@ -1829,8 +1832,22 @@ complete_and_checkout(#{} = Meta, MsgIds, ConsumerKey,
18291832 Effects0 , State0 ) ->
18301833 State1 = complete (Meta , ConsumerKey , MsgIds , Con0 , State0 ),
18311834 % % a completion could have removed the active/quiescing consumer
1832- {State2 , Effects1 } = activate_next_consumer (State1 , Effects0 ),
1833- checkout (Meta , State0 , State2 , Effects1 ).
1835+ Effects1 = add_active_effect (Con0 , State1 , Effects0 ),
1836+ {State2 , Effects2 } = activate_next_consumer (State1 , Effects1 ),
1837+ checkout (Meta , State0 , State2 , Effects2 ).
1838+
1839+ add_active_effect (# consumer {status = quiescing } = Consumer ,
1840+ #? STATE {cfg = # cfg {consumer_strategy = single_active },
1841+ consumers = Consumers } = State ,
1842+ Effects ) ->
1843+ case active_consumer (Consumers ) of
1844+ undefined ->
1845+ consumer_update_active_effects (State , Consumer , false , waiting , Effects );
1846+ _ ->
1847+ Effects
1848+ end ;
1849+ add_active_effect (_ , _ , Effects ) ->
1850+ Effects .
18341851
18351852cancel_consumer_effects (ConsumerId ,
18361853 #? STATE {cfg = # cfg {resource = QName }},
0 commit comments