Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/ci/drop_pipeline_service.rb')
-rw-r--r--app/services/ci/drop_pipeline_service.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/app/services/ci/drop_pipeline_service.rb b/app/services/ci/drop_pipeline_service.rb
index f510943251b..16d3abcbfa0 100644
--- a/app/services/ci/drop_pipeline_service.rb
+++ b/app/services/ci/drop_pipeline_service.rb
@@ -2,6 +2,9 @@
module Ci
class DropPipelineService
+ PRELOADED_COMMIT_STATUS_RELATIONS = [:project, :pipeline].freeze
+ PRELOADED_CI_BUILD_RELATIONS = [:metadata, :deployment, :taggings].freeze
+
# execute service asynchronously for each cancelable pipeline
def execute_async_for_all(pipelines, failure_reason, context_user)
pipelines.cancelable.select(:id).find_in_batches do |pipelines_batch|
@@ -27,11 +30,11 @@ module Ci
private
- def preload_associations_for_drop(builds_batch)
- ActiveRecord::Associations::Preloader.new.preload( # rubocop: disable CodeReuse/ActiveRecord
- builds_batch,
- [:project, :pipeline, :metadata, :deployment, :taggings]
- )
+ # rubocop: disable CodeReuse/ActiveRecord
+ def preload_associations_for_drop(commit_status_batch)
+ ActiveRecord::Associations::Preloader.new.preload(commit_status_batch, PRELOADED_COMMIT_STATUS_RELATIONS)
+ ActiveRecord::Associations::Preloader.new.preload(commit_status_batch.select { |job| job.is_a?(Ci::Build) }, PRELOADED_CI_BUILD_RELATIONS)
end
+ # rubocop: enable CodeReuse/ActiveRecord
end
end