Skip to content

Commit 7f2f870

Browse files
committed
Revert "Merge pull request rails#41046 from eileencodes/dont-check-if-qc-is-enabled"
This reverts commit c97f1f1, reversing changes made to ac7851e. We haven't quite tracked down why yet, but this change caused our API to not use the query cache. Our API is Sinatra mixed with Rails. We install the Exectutor in our API so it was installed. However, (some?) production requests were showing 0 query cache hits. jhawthorn found that we likely need this check because if we don't the pools returned will be a different set. He'll send a test later today.
1 parent c222568 commit 7f2f870

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

activerecord/lib/active_record/query_cache.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ def self.run
3030

3131
if ActiveRecord::Base.legacy_connection_handling
3232
ActiveRecord::Base.connection_handlers.each do |key, handler|
33-
pools.concat(handler.connection_pool_list.each { |p| p.enable_query_cache! })
33+
pools.concat(handler.connection_pool_list.reject { |p| p.query_cache_enabled }.each { |p| p.enable_query_cache! })
3434
end
3535
else
36-
pools.concat(ActiveRecord::Base.connection_handler.all_connection_pools.each { |p| p.enable_query_cache! })
36+
pools.concat(ActiveRecord::Base.connection_handler.all_connection_pools.reject { |p| p.query_cache_enabled }.each { |p| p.enable_query_cache! })
3737
end
3838

3939
pools

0 commit comments

Comments
 (0)