-
Notifications
You must be signed in to change notification settings - Fork 656
Open
Labels
Milestone
Description
I belive this is common scenario, when user wants to use select! and join! macros together.
The easiest example is a circuit breaker (like a timeout) for long running concurrect task.
For example:
use futures::{select, join};
async fn foo() {
select! {
(r1, r2) = join!(long_running_task_1, long_running_task_2) => { return result },
_ = circuit_breaker => { report error },
}
}
For now this wouldn't work, as join! and select! macros both awaits internally.
I found a few workarounds for this, but they aren't convinient nor elegant.
- create async block, call join internally
- use join, join2, join3 - does not allow any number of futures
- join_all - required all futures to be returning the same type (or even to be the same type)
Is there any way to combine those two together?