diff options
author | korbin <k1@k1.io> | 2014-12-17 19:45:31 -0700 |
---|---|---|
committer | korbin <k1@k1.io> | 2014-12-17 19:45:31 -0700 |
commit | 27955b4bb11fc6a7ee8a0fcaff53b6fc175a9655 (patch) | |
tree | 22f2c05bad778361be2b04c02faa6c251d6cd22e | |
parent | 3f6a472d921cfdc8e388e7fb97cda0b07bfe4d5c (diff) | |
download | rails-27955b4bb11fc6a7ee8a0fcaff53b6fc175a9655.tar.gz rails-27955b4bb11fc6a7ee8a0fcaff53b6fc175a9655.tar.bz2 rails-27955b4bb11fc6a7ee8a0fcaff53b6fc175a9655.zip |
fix issue with reaping_frequency type
When using DATABASE_URL to configure ActiveRecord, :reaping_frequency
does not get converted from a string to a numeric value. This value is
eventually passed to 'sleep' and must be numeric to avoid exceptions.
This commit converts :reaping_frequency to a float when present.
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/reaper_test.rb | 2 |
2 files changed, 2 insertions, 2 deletions
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 0fa00d03a3..33165cd8fa 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 |