Commit f8e21145 authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'rm-ff-custom_preloader_for_deployments' into 'master'

Remove Feature Flag custom preloader for deployments

See merge request gitlab-org/gitlab!78197
parents 09f545c1 b173add5
...@@ -52,17 +52,13 @@ class EnvironmentSerializer < BaseSerializer ...@@ -52,17 +52,13 @@ class EnvironmentSerializer < BaseSerializer
end end
def batch_load(resource) def batch_load(resource)
if ::Feature.enabled?(:custom_preloader_for_deployments, default_enabled: :yaml) resource = resource.preload(environment_associations.except(:last_deployment, :upcoming_deployment))
resource = resource.preload(environment_associations.except(:last_deployment, :upcoming_deployment))
Preloaders::Environments::DeploymentPreloader.new(resource) Preloaders::Environments::DeploymentPreloader.new(resource)
.execute_with_union(:last_deployment, deployment_associations) .execute_with_union(:last_deployment, deployment_associations)
Preloaders::Environments::DeploymentPreloader.new(resource) Preloaders::Environments::DeploymentPreloader.new(resource)
.execute_with_union(:upcoming_deployment, deployment_associations) .execute_with_union(:upcoming_deployment, deployment_associations)
else
resource = resource.preload(environment_associations)
end
resource.all.to_a.tap do |environments| resource.all.to_a.tap do |environments|
environments.each do |environment| environments.each do |environment|
......
---
name: custom_preloader_for_deployments
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75767
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/348289
milestone: '14.7'
type: development
group: group::release
default_enabled: false
...@@ -204,21 +204,6 @@ RSpec.describe EnvironmentSerializer do ...@@ -204,21 +204,6 @@ RSpec.describe EnvironmentSerializer do
json json
end end
# Including for test coverage pipeline failure, remove along with feature flag.
context 'when custom preload feature is disabled' do
before do
Feature.disable(:custom_preloader_for_deployments)
end
it 'avoids N+1 database queries' do
control_count = ActiveRecord::QueryRecorder.new { json }.count
create_environment_with_associations(project)
expect { json }.not_to exceed_query_limit(control_count)
end
end
end end
def create_environment_with_associations(project) def create_environment_with_associations(project)
......
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