diff options
author | Matthew Draper <matthew@trebex.net> | 2016-10-05 05:23:48 +1030 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-05 05:23:48 +1030 |
commit | 4d6feef79248a63c4cefde3f9ceb2242925e8d8d (patch) | |
tree | 83724eea7492b2ad61638c0bfa41c9b6411a3ad4 /activerecord/lib/active_record | |
parent | 6ecb14715e4d5acb06c282b96b795404e25c7a11 (diff) | |
parent | e8b36e7711d44bf23a39426b3d766c08528573b3 (diff) | |
download | rails-4d6feef79248a63c4cefde3f9ceb2242925e8d8d.tar.gz rails-4d6feef79248a63c4cefde3f9ceb2242925e8d8d.tar.bz2 rails-4d6feef79248a63c4cefde3f9ceb2242925e8d8d.zip |
Merge pull request #26684 from matthewd/executor-serial
Avoid bumping the class serial when invoking executor
Diffstat (limited to 'activerecord/lib/active_record')
-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 |