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

Properly await for all futures in Future for TelemetryDriver #88

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nox
Copy link
Collaborator

@nox nox commented Nov 8, 2024

No description provided.

if let Poll::Ready(res) = Pin::new(server_fut).poll(cx) {
ready_res.push(res.map_err(|err| anyhow!(err)));
if let Poll::Ready(()) = Pin::new(server_fut).poll(cx)? {
self.server_fut = None;
Copy link
Collaborator

Choose a reason for hiding this comment

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

doesn't it mean we'll poll the server just once?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, this checks for Poll::Ready(()), so it will be polled until it's ready.

}
}

let tele_futures_poll = Pin::new(&mut self.tele_futures).poll_next(cx);
ready!(Pin::new(&mut self.tele_futures).poll_next(cx)?);
Copy link
Collaborator

Choose a reason for hiding this comment

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

technically we should call self.tele_futures.is_terminated() first, but FuturesUnordered would be hard to work with if you couldn't call poll_next as many times as you like

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