forked from ManageIQ/manageiq-rpm_build
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply performance regression patch onto 4.7.1 srpm
Based on the PR from: ManageIQ/manageiq#23277 For jira issue: https://jsw.ibm.com/browse/CP4AIOPS-8477
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
rpm_spec/patches/0001-Merge-pull-request-23277-from-kbrock-preload_associa.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|