0.12.0 regression: Selector::wait_timeout on an empty Selector hangs forever
I have some code that conditionally spawns channels, and needs to block waiting for any of them to have a message ready, or timeout. Every time a channel is spawned, it's added to the selector via `Selector::recv`. But because the channels are conditionally added, the selector may be empty.
My expectation is that trying to wait on an empty Selector returns some sort of error immediately. `Timeout` would be fine here, or a new `SelectError::Empty` variant to indicate that there's nothing to select upon.
This test passes on flume 0.11.1, but hangs forever on 0.12.0.
```
#[test]
fn wait_timeout_empty_selector_times_out() {
// Nothing is attached to this Selector.
// The only reasonable thing here is to timeout either immediately or
let result = flume::Selector::new()
.wait_timeout(Duration::from_millis(10));
assert!(result.is_err());
}
```
关闭于 2026-04-16 2 条评论