Add common ThreadingHelper
module for specs (#29116)
This commit is contained in:
parent
dbafec88e5
commit
95da28d201
6 changed files with 40 additions and 57 deletions
|
@ -33,18 +33,14 @@ describe RequestPool do
|
|||
|
||||
subject
|
||||
|
||||
threads = Array.new(5) do
|
||||
Thread.new do
|
||||
subject.with('http://example.com') do |http_client|
|
||||
http_client.get('/').flush
|
||||
# Nudge scheduler to yield and exercise the full pool
|
||||
sleep(0.01)
|
||||
end
|
||||
multi_threaded_execution(5) do
|
||||
subject.with('http://example.com') do |http_client|
|
||||
http_client.get('/').flush
|
||||
# Nudge scheduler to yield and exercise the full pool
|
||||
sleep(0.01)
|
||||
end
|
||||
end
|
||||
|
||||
threads.map(&:join)
|
||||
|
||||
expect(subject.size).to be > 1
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue