@@ -31,16 +31,19 @@ pub(crate) fn make_wft_poller(
3131> + Sized
3232+ ' static {
3333 let wft_metrics = metrics. with_new_attrs ( [ workflow_poller ( ) ] ) ;
34+ let poller_behavior = wft_poller_behavior ( config, false ) ;
3435 let wft_poller_shared = if sticky_queue_name. is_some ( ) {
35- Some ( Arc :: new ( WFTPollerShared :: new ( ) ) )
36+ Some ( Arc :: new ( WFTPollerShared :: new (
37+ poller_behavior. is_autoscaling ( ) ,
38+ ) ) )
3639 } else {
3740 None
3841 } ;
3942 let wf_task_poll_buffer = LongPollBuffer :: new_workflow_task (
4043 client. clone ( ) ,
4144 config. task_queue . clone ( ) ,
4245 None ,
43- wft_poller_behavior ( config , false ) ,
46+ poller_behavior ,
4447 wft_slots. clone ( ) ,
4548 shutdown_token. child_token ( ) ,
4649 Some ( move |np| {
@@ -78,14 +81,16 @@ pub(crate) struct WFTPollerShared {
7881 last_seen_sticky_backlog : ( watch:: Receiver < usize > , watch:: Sender < usize > ) ,
7982 sticky_active : OnceLock < watch:: Receiver < usize > > ,
8083 non_sticky_active : OnceLock < watch:: Receiver < usize > > ,
84+ using_autoscaling : bool ,
8185}
8286impl WFTPollerShared {
83- pub ( crate ) fn new ( ) -> Self {
87+ pub ( crate ) fn new ( using_autoscaling : bool ) -> Self {
8488 let ( tx, rx) = watch:: channel ( 0 ) ;
8589 Self {
8690 last_seen_sticky_backlog : ( rx, tx) ,
8791 sticky_active : OnceLock :: new ( ) ,
8892 non_sticky_active : OnceLock :: new ( ) ,
93+ using_autoscaling,
8994 }
9095 }
9196 pub ( crate ) fn set_sticky_active ( & self , rx : watch:: Receiver < usize > ) {
@@ -115,7 +120,7 @@ impl WFTPollerShared {
115120 // for the sticky poller when counts are equal. This does not mean we always have equal
116121 // numbers of pollers, as later on the scaler will also prevent polling based on the scaling
117122 // information provided independently by the sticky/nonsticky queues.
118- if * self . last_seen_sticky_backlog . 0 . borrow ( ) == 0 {
123+ if ! self . using_autoscaling && * self . last_seen_sticky_backlog . 0 . borrow ( ) == 0 {
119124 if let Some ( ( sticky_active, non_sticky_active) ) =
120125 self . sticky_active . get ( ) . zip ( self . non_sticky_active . get ( ) )
121126 {
0 commit comments