Skip to content

Commit 37f8923

Browse files
committed
Fix unused values
1 parent ee26a92 commit 37f8923

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

core/src/worker/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -867,9 +867,10 @@ fn wft_poller_behavior(config: &WorkerConfig, is_sticky: bool) -> PollerBehavior
867867
config.nonsticky_to_sticky_poll_ratio,
868868
))
869869
} else {
870-
PollerBehavior::SimpleMaximum(m.saturating_sub(
871-
calc_max_nonsticky(m, config.nonsticky_to_sticky_poll_ratio).max(1),
872-
))
870+
PollerBehavior::SimpleMaximum(
871+
m.saturating_sub(calc_max_nonsticky(m, config.nonsticky_to_sticky_poll_ratio))
872+
.max(1),
873+
)
873874
}
874875
} else {
875876
config.workflow_task_poller_behavior

core/src/worker/workflow/wft_poller.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl WFTPollerShared {
101101
/// balance which kind of queue we poll appropriately.
102102
pub(crate) async fn wait_if_needed(&self, is_sticky: bool) {
103103
// Sticky shouldn't start polling until after the first non-sticky poll has been allowed
104-
if is_sticky {
104+
if is_sticky && !self.have_done_first_poll.load(Ordering::Relaxed) {
105105
self.wait_for_first_nonsticky_poll.notified().await;
106106
}
107107
// If there's a sticky backlog, prioritize it.
@@ -112,13 +112,13 @@ impl WFTPollerShared {
112112
.last_seen_sticky_backlog
113113
.0
114114
.clone()
115-
.wait_for(|v| *v < 1)
115+
.wait_for(|v| *v == 0)
116116
.await;
117117
}
118118
}
119119

120-
// If there's no meaningful sticky backlog, balance poller counts
121-
if *self.last_seen_sticky_backlog.0.borrow() <= 1 {
120+
// If there's no sticky backlog, balance poller counts
121+
if *self.last_seen_sticky_backlog.0.borrow() == 0 {
122122
if let Some((sticky_active, non_sticky_active)) =
123123
self.sticky_active.get().zip(self.non_sticky_active.get())
124124
{
@@ -135,6 +135,8 @@ impl WFTPollerShared {
135135
|| !self.have_done_first_poll.load(Ordering::Relaxed)
136136
})
137137
.await;
138+
self.have_done_first_poll.store(true, Ordering::Relaxed);
139+
self.wait_for_first_nonsticky_poll.notify_waiters();
138140
}
139141
}
140142
}

0 commit comments

Comments
 (0)