提交 70c2777d 编写于 作者: R Rafael Mendonça França

Merge pull request #18080 from korbin/fix_reaping_frequency_configuration

Fix issue with reaping_frequency type.
* Fix `reaping_frequency` option when the value is a string.
This usually happens when it is configured using `DATABASE_URL`.
*korbin*
* Fix error message when trying to create an associated record and the foreign
key is missing.
......
......@@ -236,7 +236,7 @@ def initialize(spec)
@spec = spec
@checkout_timeout = (spec.config[:checkout_timeout] && spec.config[:checkout_timeout].to_f) || 5
@reaper = Reaper.new self, spec.config[:reaping_frequency]
@reaper = Reaper.new(self, (spec.config[:reaping_frequency] && spec.config[:reaping_frequency].to_f))
@reaper.run
# default max pool size to 5
......
......@@ -60,7 +60,7 @@ def test_reaping_frequency_configuration
def test_connection_pool_starts_reaper
spec = ActiveRecord::Base.connection_pool.spec.dup
spec.config[:reaping_frequency] = 0.0001
spec.config[:reaping_frequency] = '0.0001'
pool = ConnectionPool.new spec
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册