Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispatcher: test cleanup #3749

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ class DispatcherSpec extends BaseSpec with DetectPlatform {
implicit ticker =>
val test = dispatcher.allocated.flatMap {
case (runner, release) =>
IO(runner.unsafeRunAndForget(IO.sleep(50.millis) *> release)) *>
IO(runner.unsafeRunAndForget(release)) *>
Comment on lines 360 to +363
Copy link
Member

Choose a reason for hiding this comment

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

I was briefly confused why we added this sleep in the first place, for a ticked test ... and it's because in #3593 it was originally a real test and the sleep helped avoid the race condition where the release started while the unsafeRunAndForget was still executing.

tl;dr this test is a lot more robust now.

IO.sleep(100.millis) *>
IO(runner.unsafeRunAndForget(IO(ko)) must throwAn[IllegalStateException])
}
Expand Down
Loading