Skip to content

Commit

Permalink
bias the select! to ensure that the long sleep is awaited first.
Browse files Browse the repository at this point in the history
  • Loading branch information
Erk- committed Jun 10, 2023
1 parent 48cdd43 commit 0015c26
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tokio/tests/time_sleep.rs
Expand Up @@ -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)) => {}
}
Expand Down

0 comments on commit 0015c26

Please sign in to comment.