Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed blocking queue iterator #301

Merged
merged 1 commit into from
Jun 28, 2020
Merged

Conversation

merlimat
Copy link
Contributor

Motivation

The blocking queue iterator method is not really thread safe in the presence of other read/write operations on the queue. While it makes a snapshot of what's readable at one point, if there are Poll() operations, it might be ending up reading new items before the new ones.

For that, it's better to make a copy of the items in the queue, also considering that iterating over this queue is only done on reconnections and it's not performance sensitive.

Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

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

LGTM +1

@wolfstudy wolfstudy merged commit 975eb37 into apache:master Jun 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants