Use now_or_never for filling scheduler instead of Stream::next with timeout#734
Merged
Use now_or_never for filling scheduler instead of Stream::next with timeout#734
now_or_never for filling scheduler instead of Stream::next with timeout#734Conversation
haixuanTao
reviewed
Dec 10, 2024
Collaborator
haixuanTao
left a comment
There was a problem hiding this comment.
Ok with me!
But it seems that the python ros2 bridge is now failing.
a643f8d to
c6c6d37
Compare
Collaborator
Author
|
Rebased against Benchmarks with |
Collaborator
Author
|
The ros2 error seems legit, looking into it edit: should be fixed with 59c9be5 |
Constructing the `Stream` on the fly in `poll_next` doesn't work as dropping the stream will also drop the registered waker handle. So no wakeup happens anymore. So we need to keep the long-lived `RecvStream` type, which doesn't have a `try_recv` method. However, we can use `next().now_or_never()` for the same effect.
Receiver::try_recv instead of Stream::next with timeoutnow_or_never for filling scheduler instead of Stream::next with timeout
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.
In #724 (comment), I proposed to use
try_recvto avoid the timeout. Unfortunately this approach doesn't work because we implementStreamdirectly onEventStream. This makes it necessary to store a long-lived stream type in theEventStreamstruct instead of the underlying channel (as constructing the stream on the fly will not register the async waker properly).So this PR now uses
next().now_or_never()for the same effect.