From a6d14df40f81ae766081e6a5d4e5fa428eca3174 Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sun, 6 Nov 2016 01:50:15 -0500 Subject: Try harder to avoid making a connection while releasing it connected? doesn't mean what we need here. --- activerecord/lib/active_record/query_cache.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb index 23dae825c2..667bfe96f6 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -28,8 +28,8 @@ module ActiveRecord end def self.complete(_) - unless ActiveRecord::Base.connected? && ActiveRecord::Base.connection.transaction_open? - ActiveRecord::Base.clear_active_connections! + ActiveRecord::Base.connection_handler.connection_pool_list.each do |pool| + pool.release_connection if pool.active_connection? && !pool.connection.transaction_open? end end -- cgit v1.2.3