diff options
author | Matthew Draper <matthew@trebex.net> | 2016-10-03 01:34:27 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2016-10-03 13:35:51 +1030 |
commit | e8b36e7711d44bf23a39426b3d766c08528573b3 (patch) | |
tree | b9c6b801df7cf50c3902cb5c50dbe22089dc3837 /activerecord | |
parent | 7b63f56ce0c708f05db31de04b8cd2dc6e4ef96b (diff) | |
download | rails-e8b36e7711d44bf23a39426b3d766c08528573b3.tar.gz rails-e8b36e7711d44bf23a39426b3d766c08528573b3.tar.bz2 rails-e8b36e7711d44bf23a39426b3d766c08528573b3.zip |
Avoid bumping the class serial when invoking executor
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/query_cache.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb index 387dd8e9bd..c45c8c1697 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -34,16 +34,14 @@ module ActiveRecord def self.complete(enabled) ActiveRecord::Base.connection.clear_query_cache ActiveRecord::Base.connection.disable_query_cache! unless enabled + + unless ActiveRecord::Base.connected? && ActiveRecord::Base.connection.transaction_open? + ActiveRecord::Base.clear_active_connections! + end end def self.install_executor_hooks(executor = ActiveSupport::Executor) executor.register_hook(self) - - executor.to_complete do - unless ActiveRecord::Base.connected? && ActiveRecord::Base.connection.transaction_open? - ActiveRecord::Base.clear_active_connections! - end - end end end end |