Closed Mivik closed 5 months ago
Currently the faulty implementation of min_timeout yields the greatest delay of current entries, which could cause misbehavior when multiple timers are used. For example:
min_timeout
#[compio::main] async fn main() -> Result<()> { compio::runtime::spawn(async move { compio::time::sleep(std::time::Duration::from_secs(1)).await; println!("1s elapsed"); }) .detach(); compio::time::sleep(Duration::from_secs(5)).await; println!("5s elapsed"); Ok(()) }
This will hang for 5 seconds and prints two statements without specific order.
Simply reversing the order of TimeEntry fixes the problem. Also a unit test is added.
TimeEntry
Currently the faulty implementation of
min_timeout
yields the greatest delay of current entries, which could cause misbehavior when multiple timers are used. For example:This will hang for 5 seconds and prints two statements without specific order.
Simply reversing the order of
TimeEntry
fixes the problem. Also a unit test is added.