aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-11-06 01:50:15 -0500
committerMatthew Draper <matthew@trebex.net>2016-11-06 02:02:42 -0500
commita6d14df40f81ae766081e6a5d4e5fa428eca3174 (patch)
tree57615ee64ab6bb8aa9257ef5bb82b80c3e629ccc /activerecord/lib/active_record
parent3359093ff622438141add95edf350c0b288176a0 (diff)
downloadrails-a6d14df40f81ae766081e6a5d4e5fa428eca3174.tar.gz
rails-a6d14df40f81ae766081e6a5d4e5fa428eca3174.tar.bz2
rails-a6d14df40f81ae766081e6a5d4e5fa428eca3174.zip
Try harder to avoid making a connection while releasing it
connected? doesn't mean what we need here.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/query_cache.rb4
1 files changed, 2 insertions, 2 deletions
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