提交 405aeb5d 编写于 作者: A Aaron Patterson

connection pool starts the reaper

上级 3af68df0
......@@ -107,6 +107,7 @@ def initialize(spec)
@timeout = spec.config[:wait_timeout] || 5
@reaper = Reaper.new self, spec.config[:reaping_frequency]
@reaper.start
# default max pool size to 5
@size = (spec.config[:pool] && spec.config[:pool].to_i) || 5
......
......@@ -52,6 +52,22 @@ def test_reaping_frequency_configuration
pool = ConnectionPool.new spec
assert_equal 100, pool.reaper.frequency
end
def test_connection_pool_starts_reaper
spec = ActiveRecord::Base.connection_pool.spec.dup
spec.config[:reaping_frequency] = 0.0001
pool = ConnectionPool.new spec
pool.timeout = 0
conn = pool.checkout
count = pool.connections.length
conn.extend(Module.new { def active?; false; end; })
sleep 0.0002
assert_equal(count - 1, pool.connections.length)
end
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册