From f375003680f789a72e895bb7eeee8c0b393ddcf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 2 Jan 2015 01:35:29 -0300 Subject: [PATCH] Merge pull request #18080 from korbin/fix_reaping_frequency_configuration Fix issue with reaping_frequency type. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb --- activerecord/CHANGELOG.md | 6 ++++++ .../connection_adapters/abstract/connection_pool.rb | 2 +- activerecord/test/cases/reaper_test.rb | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index e7c2fd304a234..41f2f3960065d 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* + * `db:schema:load` and `db:structure:load` no longer purge the database before loading the schema. This is left for the user to do. `db:test:prepare` will still purge the database. 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 b459b949d2e34..b0f03c4e94e96 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -238,7 +238,7 @@ def initialize(spec) @checkout_timeout = (spec.config[:checkout_timeout] && spec.config[:checkout_timeout].to_f) || 5 @dead_connection_timeout = (spec.config[:dead_connection_timeout] && spec.config[:dead_connection_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 b62a41c08e59f..b72898f735491 100644 --- a/activerecord/test/cases/reaper_test.rb +++ b/activerecord/test/cases/reaper_test.rb @@ -61,7 +61,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 pool.dead_connection_timeout = 0