Feature request: Add biased
support to join!
and try_join!
#7304
Labels
A-tokio
Area: The main tokio crate
C-feature-request
Category: A feature request.
M-macros
Module: macros in the main Tokio crate
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
I have two long-running futures that I need to drive locally in a task.
Specifically, the futures are a AWS Lambda function handler listener, and secondary event listener that does some extra cleanup operations after the main event processing is complete. Something along these lines.
Normally I would reach for
join!
ortry_join!
for this. However, I don't actually want to rotate which future I poll first. I want to always poll my primary server if it is ready to make progress, over the 'cleanup' event listener. Context here is that an AWS Lambda only receives one request a time per node.Instead, I want to invoke
join!
ortry_join!
in a way that always polls sequentially based on the order of futures in the macro body.Describe the solution you'd like
Tokio added
biased
support toselect!
some time back - #2181It would be great to have the same API for
join!
ortry_join!
Describe alternatives you've considered
You can accomplish the same thing using
select!
in a loop, andselect!
does supportbiased
.This gets very verbose though since you need to explicitly continue polling subsequent futures after one of them finishes.
join!
andtry_join!
are much friendlier APIs for this use case.The text was updated successfully, but these errors were encountered: