aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-02 01:35:29 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-02 01:37:07 -0300
commit70c2777d1c2bfaf538c5bc892a5c3f96f67291f1 (patch)
treeda637ec1b0c6a1ba9e1dd5cfddd982b41ecfe7b3 /activerecord
parent7c6861b0bc85077ed1f1dcb4a919de0f1b8d490d (diff)
parent27955b4bb11fc6a7ee8a0fcaff53b6fc175a9655 (diff)
downloadrails-70c2777d1c2bfaf538c5bc892a5c3f96f67291f1.tar.gz
rails-70c2777d1c2bfaf538c5bc892a5c3f96f67291f1.tar.bz2
rails-70c2777d1c2bfaf538c5bc892a5c3f96f67291f1.zip
Merge pull request #18080 from korbin/fix_reaping_frequency_configuration
Fix issue with reaping_frequency type.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG.md6
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb2
-rw-r--r--activerecord/test/cases/reaper_test.rb2
3 files changed, 8 insertions, 2 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 859ba38588..ea8c8088a9 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,3 +1,9 @@
+* 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.
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
index 3968b90341..6235745fb2 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
@@ -236,7 +236,7 @@ module ActiveRecord
@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
diff --git a/activerecord/test/cases/reaper_test.rb b/activerecord/test/cases/reaper_test.rb
index f52fd22489..cccfc6774e 100644
--- a/activerecord/test/cases/reaper_test.rb
+++ b/activerecord/test/cases/reaper_test.rb
@@ -60,7 +60,7 @@ module ActiveRecord
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