Using Tokio, there are too many .select()


#1

I am using tokio, future.

My code has several timer intervals.

let wakeup1 = Interval::new(10);
let wakeup2 = Interval::new(…);
let wakeup3 = Interval::new…

let wakeup1_future = wakeup1.for_each(…);
let wakeup2_future = wakeup2.for_each(…);

let sender = sender.select(wakeup1_future)
.select(wakeup2_future)
.select(wakeup3_future)
.select()…

In rustc nightly, it success compile.
But stable rustc, it can’t compile and hangs forever.

I am trying to replace .select() with something other.
Is there any good way?
Thanks in advance.


#2

How many of these chains do you have exactly? One thing you can try is to sprinkle in Box here and there to erase the type - there was a compiler bug where long combinator chains killed compilation times.