From bb0e8ed0d2accdbf7f52ceaf16c29d4a6721c597 Mon Sep 17 00:00:00 2001 From: Valdemar Erk Date: Sat, 10 Jun 2023 13:04:39 +0200 Subject: [PATCH] bias the select! to ensure that the long sleep is awaited first. --- tokio/tests/time_sleep.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tokio/tests/time_sleep.rs b/tokio/tests/time_sleep.rs index c9f7535c279..a68f8465830 100644 --- a/tokio/tests/time_sleep.rs +++ b/tokio/tests/time_sleep.rs @@ -274,6 +274,7 @@ async fn issue_5183() { let big = std::time::Duration::from_secs(u64::MAX / 10); // This is a workaround since awaiting sleep(big) will never finish. tokio::select! { + biased; _ = tokio::time::sleep(big) => {} _ = tokio::time::sleep(std::time::Duration::from_nanos(1)) => {} }