From 34a7e68bb9a7fa07c12092d916317f837b422a6a Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Wed, 31 Jul 2019 17:30:25 +0900 Subject: Reduce Array allocations --- activerecord/lib/active_record/query_cache.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb index 43a21e629e..881ba623b8 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -29,10 +29,10 @@ module ActiveRecord pools = [] ActiveRecord::Base.connection_handlers.each do |key, handler| - pools << handler.connection_pool_list.reject { |p| p.query_cache_enabled }.each { |p| p.enable_query_cache! } + pools.concat(handler.connection_pool_list.reject { |p| p.query_cache_enabled }.each { |p| p.enable_query_cache! }) end - pools.flatten + pools end def self.complete(pools) -- cgit v1.2.3