Skip to content

Commit

Permalink
Don't attempt to clear active connections unless we'ere connected
Browse files Browse the repository at this point in the history
Right now with this middleware we are likely always connected, but I'm
hoping to change that soon. This is an easy change to pull out on its
own.
  • Loading branch information
sgrif committed Jun 29, 2016
1 parent 4565de0 commit 160cc33
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/query_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def self.install_executor_hooks(executor = ActiveSupport::Executor)
executor.register_hook(self)

executor.to_complete do
unless ActiveRecord::Base.connection.transaction_open?
unless ActiveRecord::Base.connected? && ActiveRecord::Base.connection.transaction_open?
ActiveRecord::Base.clear_active_connections!
end
end
Expand Down

0 comments on commit 160cc33

Please sign in to comment.