aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-08-11 02:15:28 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-08-11 02:15:28 +0900
commitedeb251fb73f92b8d9115c4f3c7bb46fcee10c67 (patch)
tree2f4038ddedf49b30e0c3afff0d1fb59a9b3d4889
parentda589fcc4a15cdc923b9df55f9fe964df996e49b (diff)
downloadrails-edeb251fb73f92b8d9115c4f3c7bb46fcee10c67.tar.gz
rails-edeb251fb73f92b8d9115c4f3c7bb46fcee10c67.tar.bz2
rails-edeb251fb73f92b8d9115c4f3c7bb46fcee10c67.zip
Start `@reaper.run` after connection pool initialized
Otherwise `ConnectionPool#reap` may run before `@connections` has initialized. https://travis-ci.org/rails/rails/jobs/263037427#L888-L890
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb5
1 files changed, 3 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 c11b7b012f..11b5f48dc7 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
@@ -326,8 +326,6 @@ 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] && spec.config[:reaping_frequency].to_f))
- @reaper.run
# default max pool size to 5
@size = (spec.config[:pool] && spec.config[:pool].to_i) || 5
@@ -357,6 +355,9 @@ module ActiveRecord
@available = ConnectionLeasingQueue.new self
@lock_thread = false
+
+ @reaper = Reaper.new(self, spec.config[:reaping_frequency] && spec.config[:reaping_frequency].to_f)
+ @reaper.run
end
def lock_thread=(lock_thread)