diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /app/serializers/environment_serializer.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'app/serializers/environment_serializer.rb')
-rw-r--r-- | app/serializers/environment_serializer.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/serializers/environment_serializer.rb b/app/serializers/environment_serializer.rb index 2fb1ad52135..11445f93609 100644 --- a/app/serializers/environment_serializer.rb +++ b/app/serializers/environment_serializer.rb @@ -52,7 +52,17 @@ class EnvironmentSerializer < BaseSerializer end def batch_load(resource) - resource = resource.preload(environment_associations) + if ::Feature.enabled?(:custom_preloader_for_deployments, default_enabled: :yaml) + resource = resource.preload(environment_associations.except(:last_deployment, :upcoming_deployment)) + + Preloaders::Environments::DeploymentPreloader.new(resource) + .execute_with_union(:last_deployment, deployment_associations) + + Preloaders::Environments::DeploymentPreloader.new(resource) + .execute_with_union(:upcoming_deployment, deployment_associations) + else + resource = resource.preload(environment_associations) + end resource.all.to_a.tap do |environments| environments.each do |environment| |