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

Conversation

samspills
Copy link
Contributor

Just removing the extra sleep that was added here: #3593. The sleep was added as part of a short-term fix for flakiness and now that the second check on alive (and possible cancellation of the submitted task) is gone, this test shouldn't flake.

I added a .replicateA(20000) on line 366 to convince myself that this was stable 🤞🏻

I believe that this sleep is no longer necessary now that the `alive`
resource, and it's associated race condition, has been removed.
@samspills samspills self-assigned this Jul 14, 2023
Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

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

Thanks for following-up!

Comment on lines 360 to +363
implicit ticker =>
val test = dispatcher.allocated.flatMap {
case (runner, release) =>
IO(runner.unsafeRunAndForget(IO.sleep(50.millis) *> release)) *>
IO(runner.unsafeRunAndForget(release)) *>
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.

@samspills samspills merged commit 6a408b6 into typelevel:series/3.5.x Jul 15, 2023
36 checks passed
@samspills samspills deleted the sam/dispatcher-tests-cleanup branch July 15, 2023 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants