Skip to content

Commit

Permalink
Try harder to avoid making a connection while releasing it
Browse files Browse the repository at this point in the history
connected? doesn't mean what we need here.
  • Loading branch information
matthewd committed Nov 6, 2016
1 parent 3359093 commit a6d14df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions activerecord/lib/active_record/query_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def self.run
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

Expand Down

0 comments on commit a6d14df

Please sign in to comment.