Strange tokio select behavior

future::ready() is not useful to poll. "Almost always ready" futures are not the same as "always ready" futures.

Replace the always-ready branch with one that is ready with a probability slightly less than 1 and the channel will continue making progress, albeit slowly.

_ = std::future::poll_fn(|_| {
    if rng.gen_bool(0.999_99) {
        Poll::Ready(())
    } else {
        Poll::Pending
    }
}) => {}

If you do have a future that is always ready on first poll, you can use something like this to periodically force it to yield to its siblings.

It is kind of bad that future::ready() doesn't compose well with other futures. That's sort of its purpose.

1 Like