Skip to content

Conversation

Quinn-With-Two-Ns
Copy link
Contributor

Make StickyQueueBalancer synchronized to avoid potential race where all initial calls to makePoll() all get assigned the same task queue.

Make StickyQueueBalancer synchronized to avoid potential race where all initial calls to `makePoll()` all get assigned the same task queue.
@Quinn-With-Two-Ns Quinn-With-Two-Ns marked this pull request as ready for review April 8, 2024 18:16
@Quinn-With-Two-Ns Quinn-With-Two-Ns requested a review from a team as a code owner April 8, 2024 18:16
* @return task queue kind that should be used for the next poll
*/
public TaskQueueKind makePoll() {
public synchronized TaskQueueKind makePoll() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually linters will tell you not to add this keyword but instead make a private final object that you wrap in synchronized (theObject) { because it can be unclear to users of this class that they can cause deadlocks if they try to also synchronize on this instance. Probably fine in internal code though.

@Quinn-With-Two-Ns Quinn-With-Two-Ns merged commit 779d90c into temporalio:master Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants