Skip to content

Yield instead of sleep in component-async-tests#12567

Merged
alexcrichton merged 2 commits intobytecodealliance:mainfrom
alexcrichton:yield-dont-sleep
Feb 11, 2026
Merged

Yield instead of sleep in component-async-tests#12567
alexcrichton merged 2 commits intobytecodealliance:mainfrom
alexcrichton:yield-dont-sleep

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
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 11, 2026
@alexcrichton alexcrichton added this pull request to the merge queue Feb 11, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 11, 2026
@alexcrichton alexcrichton added this pull request to the merge queue Feb 11, 2026
Merged via the queue into bytecodealliance:main with commit 112112d Feb 11, 2026
45 checks passed
@alexcrichton alexcrichton deleted the yield-dont-sleep branch February 11, 2026 17:18
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