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

Consider adding FuturesUnordered::clear() and SelectAll::clear() #2327

Closed
erickt opened this issue Jan 22, 2021 · 3 comments · Fixed by #2415
Closed

Consider adding FuturesUnordered::clear() and SelectAll::clear() #2327

erickt opened this issue Jan 22, 2021 · 3 comments · Fixed by #2415
Labels
A-stream Area: futures::stream C-feature-request

Comments

@erickt
Copy link
Contributor

erickt commented Jan 22, 2021

We're using FuturesUnordered to race multiple connection futures in order to implement the RFC 8305 Happy Eyeballs spec. Once we make a successful connection, we're supposed to close all the other pending connections in order to free up the resources. We are wrapping our FuturesUnordered in an Option to make sure we can drop any other pending connections as soon as possible.

However, it be simpler if we could just call a FuturesUnordered::clear() to throw away the futures. Likewise, I imagine a SelectAll::clear() could also be useful.

@taiki-e
Copy link
Member

taiki-e commented Jan 28, 2021

This seems reasonable to me. I would accept a PR to add this.

@erickt
Copy link
Contributor Author

erickt commented May 10, 2021

Thanks! However @ibraheemdev ’s #2415 only implements clear for FuturesUnordered, not SelectAll. Would it be possible to implement clear for it as well?

@ibraheemdev
Copy link
Member

ah, yes, that is an easy delegation. I'll open a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-stream Area: futures::stream C-feature-request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants