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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-12-07 21:07:33 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-07 21:07:33 +0300
commit1bdc6c89c32a7380a81598629b9ad05ba9a2a94f (patch)
tree778f1dc16130b3138ab3b641e664038648046a40 /app/services
parent9a940dabf04df126e7978c0ab4b8770b86dcaaa8 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services')
-rw-r--r--app/services/bulk_imports/batched_relation_export_service.rb14
-rw-r--r--app/services/ci/components/fetch_service.rb2
2 files changed, 12 insertions, 4 deletions
diff --git a/app/services/bulk_imports/batched_relation_export_service.rb b/app/services/bulk_imports/batched_relation_export_service.rb
index 9c3b237fad7..e239a6daa4c 100644
--- a/app/services/bulk_imports/batched_relation_export_service.rb
+++ b/app/services/bulk_imports/batched_relation_export_service.rb
@@ -65,19 +65,27 @@ module BulkImports
)
end
+ # rubocop:disable Cop/InBatches
+ # rubocop:disable CodeReuse/ActiveRecord
def enqueue_batch_exports
- resolved_relation.each_batch(of: BATCH_SIZE) do |batch, batch_number|
+ batch_number = 0
+
+ resolved_relation.in_batches(of: BATCH_SIZE) do |batch|
+ batch_number += 1
+
batch_id = find_or_create_batch(batch_number).id
- ids = batch.pluck(batch.model.primary_key) # rubocop:disable CodeReuse/ActiveRecord
+ ids = batch.pluck(batch.model.primary_key)
Gitlab::Cache::Import::Caching.set_add(self.class.cache_key(export.id, batch_id), ids, timeout: CACHE_DURATION)
RelationBatchExportWorker.perform_async(user.id, batch_id)
end
end
+ # rubocop:enable Cop/InBatches
def find_or_create_batch(batch_number)
- export.batches.find_or_create_by!(batch_number: batch_number) # rubocop:disable CodeReuse/ActiveRecord
+ export.batches.find_or_create_by!(batch_number: batch_number)
end
+ # rubocop:enable CodeReuse/ActiveRecord
end
end
diff --git a/app/services/ci/components/fetch_service.rb b/app/services/ci/components/fetch_service.rb
index 4f09d47b530..f83c6e30cbb 100644
--- a/app/services/ci/components/fetch_service.rb
+++ b/app/services/ci/components/fetch_service.rb
@@ -24,7 +24,7 @@ module Ci
component_path = component_path_class.new(address: address)
result = component_path.fetch_content!(current_user: current_user)
- if result
+ if result&.content
ServiceResponse.success(payload: {
content: result.content,
path: result.path,