Skip to content

Commit

Permalink
Apply performance regression patch onto 4.7.1 srpm
Browse files Browse the repository at this point in the history
  • Loading branch information
jrafanie committed Jan 2, 2025
1 parent e0590ca commit f15d726
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From a582ab53ca80ab23cd21b9b049c895ea7173a745 Mon Sep 17 00:00:00 2001
From: Jason Frey <fryguy9@gmail.com>
Date: Fri, 22 Nov 2024 10:40:44 -0500
Subject: [PATCH] Merge pull request #23277 from kbrock/preload_associations

Avoid scope query when preloading

(cherry picked from commit 82d5b6230b1f9a59801104ce6d07dbe517ca647d)
---
infrastructure-management-core-18.0.0/lib/miq_preloader.rb | 4 +-
spec/lib/extensions/ar_to_model_hash_spec.rb | 2 +-
spec/lib/miq_preloader_spec.rb | 48 ++------------------
3 files changed, 6 insertions(+), 48 deletions(-)

diff --git a/infrastructure-management-core-18.0.0/lib/miq_preloader.rb b/infrastructure-management-core-18.0.0/lib/miq_preloader.rb
index 7c976cadc7..ecda007513 100644
--- a/infrastructure-management-core-18.0.0/lib/miq_preloader.rb
+++ b/infrastructure-management-core-18.0.0/lib/miq_preloader.rb
@@ -22,9 +22,7 @@ module MiqPreloader
# Currently an array does not work
# @return [Array<ActiveRecord::Base>] records
def self.preload(records, associations, preload_scope = nil)
- # Rails 7 changed the interface. See rails commit: e3b9779cb701c63012bc1af007c71dc5a888d35a
- # Note, added Array(records) as it could be a single element
- ActiveRecord::Associations::Preloader.new(:records => Array(records), :associations => associations, :available_records => Array(preload_scope)).call
+ ActiveRecord::Associations::Preloader.new(:records => Array(records), :associations => associations, :scope => preload_scope).call
end

# for a record, cache results. Also cache the children's links back
--
2.47.0

0 comments on commit f15d726

Please sign in to comment.