1
0
Fork 0
mirror of https://github.com/mperham/connection_pool synced 2023-03-27 23:22:21 -04:00

Speed up test_heavy_threading

This commit is contained in:
Eric Hodel 2014-02-14 16:19:59 -08:00
parent a5ec5bf1ae
commit 64e97f5a8a

View file

@ -238,14 +238,16 @@ class TestConnectionPool < Minitest::Test
def test_heavy_threading
pool = ConnectionPool.new(:timeout => 0.5, :size => 3) { NetworkConnection.new }
20.times do
threads = (0...20).map do
Thread.new do
pool.with do |net|
sleep 0.05
sleep 0.01
end
end
end
sleep 0.5
threads.map { |thread| thread.join }
end
def test_reuses_objects_when_pool_not_saturated