Skip to content

Conversation

@alexcrichton
Copy link
Member

Use cooperative yields instead of sleeps to make tests more deterministic and also avoid them unnecessarily taking up test parallelism by sleeping. Yielding should have the same effect in terms of testing by exercising behavior returning Pending in futures, so there's no expected loss in test coverage here.

Use cooperative yields instead of sleeps to make tests more
deterministic and also avoid them unnecessarily taking up test
parallelism by sleeping. Yielding should have the same effect in terms
of testing by exercising behavior returning `Pending` in futures, so
there's no expected loss in test coverage here.
@alexcrichton alexcrichton requested a review from dicej February 11, 2026 01:40
@alexcrichton alexcrichton requested a review from a team as a code owner February 11, 2026 01:40
// that we'll resolve the future independently, with or without
// giving it more work to do.
util::sleep(Duration::from_millis(100)).await;
util::yield_times(100).await;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the 100 here just an artifact from when we slept 100ms, or did we really need to yield 100 times (or at least more than 10 or so)?

@alexcrichton alexcrichton added this pull request to the merge queue Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants