util: Fix call_all hang when stream is pending#656
Merged
hawkw merged 2 commits intotower-rs:masterfrom Mar 29, 2022
Merged
Conversation
hawkw
approved these changes
Mar 28, 2022
Member
hawkw
left a comment
There was a problem hiding this comment.
this looks good to me overall, thanks for the fix!
i commented on one style suggestion, but it's not a blocker.
tower/src/util/call_all/common.rs
Outdated
| Poll::Pending => { | ||
| // TODO: We probably want to "release" the slot we reserved in Svc here. | ||
| // It may be a while until we get around to actually using it. | ||
| return Poll::Pending; |
Member
There was a problem hiding this comment.
nit, take it or leave it: now that we return Poll::Pending in this case, we could simplify the nested match to just a single match by using ready! instead:
// If it is, gather the next request (if there is one), or return `Pending` if the
// stream is not ready.
// TODO: We probably want to "release" the slot we reserved in Svc if the
// stream returns `Pending`. It may be a while until we get around to actually
// using it.
match ready!(this.stream.as_mut().poll_next(cx)) {
Some(req) => {
this.queue.push(svc.call(req));
}
None => {
// We're all done once any outstanding requests have completed
*this.eof = true;
}
}
Contributor
Author
There was a problem hiding this comment.
Thank you for the review, I've done this refactor.
auto-merge was automatically disabled
March 29, 2022 18:17
Head branch was pushed to by a user without write access
b6f403d to
b8f0301
Compare
Contributor
Author
|
@hawkw Thanks for the review! I forced push so this still needs a merge. |
hawkw
pushed a commit
that referenced
this pull request
Jun 17, 2022
hawkw
pushed a commit
that referenced
this pull request
Jun 17, 2022
hawkw
added a commit
that referenced
this pull request
Jun 17, 2022
# 0.4.13 (June 17, 2022) ### Added - **load_shed**: Public constructor for `Overloaded` error ([#661]) ### Fixed - **util**: Fix hang with `call_all` when the `Stream` of requests is pending ([#656]) - **ready_cache**: Ensure cancelation is observed by pending services ([#668], fixes [#415]) - **docs**: Fix a missing section header due to a typo ([#646]) - **docs**: Fix broken links to `Service` trait ([#659]) [#661]: #661 [#656]: #656 [#668]: #668 [#415]: #415 [#646]: #646 [#659]: #659
hawkw
added a commit
that referenced
this pull request
Jun 17, 2022
# 0.4.13 (June 17, 2022) ### Added - **load_shed**: Public constructor for `Overloaded` error ([#661]) ### Fixed - **util**: Fix hang with `call_all` when the `Stream` of requests is pending ([#656]) - **ready_cache**: Ensure cancelation is observed by pending services ([#668], fixes [#415]) - **docs**: Fix a missing section header due to a typo ([#646]) - **docs**: Fix broken links to `Service` trait ([#659]) [#661]: #661 [#656]: #656 [#668]: #668 [#415]: #415 [#646]: #646 [#659]: #659
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.
Currently
call_allwill hang in a busy loop if called when the input stream is pending.