Commit 881f5b13 authored by Stan Hu's avatar Stan Hu

Merge branch 'fix-root-controller-n-plus-1' into 'master'

Fix N+1 in the RootController#index

See merge request gitlab-org/gitlab!36805
parents 9838acbe 7bbf4dc4
...@@ -11,6 +11,7 @@ module EE ...@@ -11,6 +11,7 @@ module EE
override :preload_associations override :preload_associations
def preload_associations(projects) def preload_associations(projects)
super.with_compliance_framework_settings super.with_compliance_framework_settings
.with_group_saml_provider
end end
end end
end end
......
...@@ -145,6 +145,8 @@ module EE ...@@ -145,6 +145,8 @@ module EE
scope :with_compliance_framework_settings, -> { preload(:compliance_framework_setting) } scope :with_compliance_framework_settings, -> { preload(:compliance_framework_setting) }
scope :has_vulnerabilities, -> { joins(:vulnerabilities).group(:id) } scope :has_vulnerabilities, -> { joins(:vulnerabilities).group(:id) }
scope :with_group_saml_provider, -> { preload(group: :saml_provider) }
delegate :shared_runners_minutes, :shared_runners_seconds, :shared_runners_seconds_last_reset, delegate :shared_runners_minutes, :shared_runners_seconds, :shared_runners_seconds_last_reset,
to: :statistics, allow_nil: true to: :statistics, allow_nil: true
......
---
title: Fix N+1 in the RootController#index
merge_request: 36805
author:
type: performance
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment