-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
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! or try_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! or try_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 to select! some time back - #2181
It would be great to have the same API for join! or try_join!
Describe alternatives you've considered
You can accomplish the same thing using select! in a loop, and select! does support biased.
This gets very verbose though since you need to explicitly continue polling subsequent futures after one of them finishes. join! and try_join! are much friendlier APIs for this use case.