Class: Preloaders::Environments::DeploymentPreloader

Inherits:
Object
  • Object
show all
Defined in:
app/models/preloaders/environments/deployment_preloader.rb

Overview

This class is to batch-load deployments of multiple environments. The deployments to batch-load are fetched using UNION of N selects in a single query instead of default scoping with ‘IN (environment_id1, environment_id2 …)`. See gitlab.com/gitlab-org/gitlab/-/issues/345672#note_761852224 for more details.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environments) ⇒ DeploymentPreloader

Returns a new instance of DeploymentPreloader.



11
12
13
# File 'app/models/preloaders/environments/deployment_preloader.rb', line 11

def initialize(environments)
  @environments = environments
end

Instance Attribute Details

#environmentsObject (readonly)

Returns the value of attribute environments.



9
10
11
# File 'app/models/preloaders/environments/deployment_preloader.rb', line 9

def environments
  @environments
end

Instance Method Details

#execute_with_union(association_name, association_attributes) ⇒ Object



15
16
17
# File 'app/models/preloaders/environments/deployment_preloader.rb', line 15

def execute_with_union(association_name, association_attributes)
  load_deployment_association(association_name, association_attributes)
end