Skip to content

Remove loads of sleep statements in UTs #212

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

Merged
merged 1 commit into from
Dec 13, 2014

Conversation

rkday
Copy link
Contributor

@rkday rkday commented Dec 13, 2014

This removes all the calls to sleep() in spec/concurrent/executor/thread_pool_executor_shared.rb, replacing them with Event wait/set or CountDownLatch calls in order to block for the minimum sensible amount of time.

Consistently brings spec/concurrent/executor/{ruby,java}_thread_pool_executor_spec.rb down from 11s to 5s for me (across MRI, rbx and JRuby), so I think it's worth doing.

@@ -6,7 +6,7 @@

after(:each) do
subject.kill
sleep(0.1)
subject.wait_for_termination(0.1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this change actually brings most of the benefit.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.09%) when pulling 6861667 on rkday:executor_ut_speedup into aaeef49 on ruby-concurrency:master.

jdantonio added a commit that referenced this pull request Dec 13, 2014
Remove loads of sleep statements in UTs
@jdantonio jdantonio merged commit 1d3e005 into ruby-concurrency:master Dec 13, 2014
@jdantonio jdantonio removed the unknown label Dec 13, 2014
@pitr-ch
Copy link
Member

pitr-ch commented Dec 28, 2014

@rkday Thanks! This is a right way to go.

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.

4 participants