-
Notifications
You must be signed in to change notification settings - Fork 628
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 FuturesOrdered::prepend #2309
Comments
I think it is fine with adding a method that adds the future in a different position than push, but I'm not clear what kind of API is preferable.
At first glance, that implementation would panic if
No RFC needed. (futures-rs does not currently use a mechanism like RFC.) |
Updated the example: https://github.com/benbromhead/futures-rs/blob/2a9ebf5cfa0e076af58f6c5e46aa518a8538e6ab/futures-util/src/stream/futures_ordered.rs#L157-L169 I'll also update with some tests shortly and get it ready for a PR if you are happy with this approach / terminology |
Was searching for this exact issue, I'd suggest |
This can be closed as #2591 has been merged. |
What:
Consider adding a method to
FuturesOrdered
that allows adding a future to the front of the task queue.Why:
FuturesOrdered
is useful for completing tasks in order, however handling futures that error out or need to be retried can be messy. By creating aprepend
method, we can add new futures that retry a failed task or job to the front of the queue within a single loop.PR:
I haven't created a PR yet, but I've created a naive example implementation here: benbromhead@ba30579
E.g.
Notes:
The text was updated successfully, but these errors were encountered: