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

Address thread pool test TODOs [changelog skip] #2036

Merged
merged 1 commit into from
Oct 17, 2019

Conversation

composerinteralia
Copy link
Contributor

@composerinteralia composerinteralia commented Oct 17, 2019

These TODOs were added in 9f4edf4 while cleaning up the tests a bit.

For the first TODO, it looks like there was a point to those two lines: this and the previous test call Thread.current.kill in the thread pool block so the threads will die once some work is added. I tried to make this more obvious by starting the auto_reap! earlier and checking that it hasn't reaped any threads that are still alive.

For the other TODO I replaced sleep 10 with the Thread.pass until finish pattern we use in some other tests in this file. Now if pool.shutdown(0) fails to raise an error we finish right away rather than waiting for the 5 second ConditionVariable timeout. I also added an assertion to ensure we rescue the ForceShutdown error.

These TODOs were added in 9f4edf4 while cleaning up the tests a bit.

For the first TODO, it looks like there was a point to those two lines:
this and the previous test call `Thread.current.kill` in the thread pool
block so the threads will die once some work is added. I tried to make
this more obvious by starting the `auto_reap!` earlier and checking that
it hasn't reaped any threads that are still alive.

For the other TODO I replaced `sleep 10` with the `Thread.pass until
finish` pattern we use in some other tests in this file. Now if
`pool.shutdown(0)` fails to raise an error we finish right away rather
than waiting for the 5 second ConditionVariable timeout. I also added an
assertion to ensure we rescue the `ForceShutdown` error.
@nateberkopec
Copy link
Member

Gorgeous. Thanks!

Sent with GitHawk

@nateberkopec nateberkopec merged commit a512065 into puma:master Oct 17, 2019
@composerinteralia composerinteralia deleted the threadpool-todos branch October 18, 2019 02:34
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.

None yet

2 participants