From 160cc331796ebfbcd6da83e96f391ab5732832b6 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Wed, 29 Jun 2016 09:56:19 -0400 Subject: Don't attempt to clear active connections unless we'ere connected 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. --- activerecord/lib/active_record/query_cache.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb index fa3e306b3e..387dd8e9bd 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -40,7 +40,7 @@ module ActiveRecord 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 -- cgit v1.2.3