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

fix: poll stream until pending #2340

Merged
merged 1 commit into from
Apr 10, 2023

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented Apr 10, 2023

Motivation

streams only register the waker if they're pending
Returning "pending" when the underlying stream is still ready does not ensure that the rt will poll again.

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

},
None => Poll::Ready(None),
let mut this = self.project();
loop {
Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't this loop a no-op, as the return always ends it on the first loop?

Copy link
Collaborator

Choose a reason for hiding this comment

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

nvm i am misreading the code

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This continues the poll rx on Err(err) instead of returning Pending, and ensures that the underlying stream is completely drained or returns a valid element.

Copy link
Collaborator

@prestwich prestwich left a comment

Choose a reason for hiding this comment

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

CI failures are unrelated

@prestwich prestwich merged commit feaca04 into gakonst:master Apr 10, 2023
10 of 15 checks passed
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.

None yet

2 participants