Fix wft poll balancing with maxpoll=2#941
Merged
Sushisource merged 2 commits intomasterfrom Jun 24, 2025
Merged
Conversation
Sushisource
reviewed
Jun 20, 2025
| if both_are_zero { | ||
| let num_sticky_backlog = *sticky_backlog.borrow_and_update(); | ||
|
|
||
| let allow = || { |
Member
There was a problem hiding this comment.
This could avoid being a closure by using else-ifs... but I don't have a firm position on if that's more readable or not.
Comment on lines
+154
to
+155
| // Just balance the two poller types. | ||
| // FIXME: Do we need anything more here, to ensure proper balancing? |
Member
There was a problem hiding this comment.
Go effectively just forces there to be an even amount of both kinds of pending requests, except always favoring sticky during a backlog, and when counts are even: https://github.com/temporalio/sdk-go/blob/9682a692145f503a02b73f32435cb04bdc6f57c1/internal/internal_task_pollers.go#L782
We already are favoring it with a backlog. It's not obvious to me that just making an even amount is the best move either, but, it is what Core used to do and clearly it at least works, so we could go with that.
Sushisource
approved these changes
Jun 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
Fix a bug that prevented
PollWorkflowTaskQueueto the sticky task queue ifworkflow_task_poller_behavior = PollerBehavior::SimpleMaximum(2). This was resulting in slower performance, and would cause "sticky worker unavailable, please use original task queue." error messages on the server.