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>2022-12-20 17:22:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 17:22:11 +0300
commit0c872e02b2c822e3397515ec324051ff540f0cd5 (patch)
treece2fb6ce7030e4dad0f4118d21ab6453e5938cdd /app/workers/concerns
parentf7e05a6853b12f02911494c4b3fe53d9540d74fc (diff)
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'app/workers/concerns')
-rw-r--r--app/workers/concerns/gitlab/github_import/object_importer.rb9
-rw-r--r--app/workers/concerns/waitable_worker.rb25
2 files changed, 8 insertions, 26 deletions
diff --git a/app/workers/concerns/gitlab/github_import/object_importer.rb b/app/workers/concerns/gitlab/github_import/object_importer.rb
index 9793278ac0c..c5c7da23892 100644
--- a/app/workers/concerns/gitlab/github_import/object_importer.rb
+++ b/app/workers/concerns/gitlab/github_import/object_importer.rb
@@ -47,6 +47,9 @@ module Gitlab
# Representation is created but the developer forgot to add a
# `:github_identifiers` field.
track_and_raise_exception(project, e, fail_import: true)
+ rescue ActiveRecord::RecordInvalid => e
+ # We do not raise exception to prevent job retry
+ track_exception(project, e)
rescue StandardError => e
track_and_raise_exception(project, e)
end
@@ -86,13 +89,17 @@ module Gitlab
)
end
- def track_and_raise_exception(project, exception, fail_import: false)
+ def track_exception(project, exception, fail_import: false)
Gitlab::Import::ImportFailureService.track(
project_id: project.id,
error_source: importer_class.name,
exception: exception,
fail_import: fail_import
)
+ end
+
+ def track_and_raise_exception(project, exception, fail_import: false)
+ track_exception(project, exception, fail_import: fail_import)
raise(exception)
end
diff --git a/app/workers/concerns/waitable_worker.rb b/app/workers/concerns/waitable_worker.rb
index 9300c2a5790..f23e3fb20c2 100644
--- a/app/workers/concerns/waitable_worker.rb
+++ b/app/workers/concerns/waitable_worker.rb
@@ -6,33 +6,8 @@ module WaitableWorker
class_methods do
# Schedules multiple jobs and waits for them to be completed.
def bulk_perform_and_wait(args_list)
- # Short-circuit: it's more efficient to do small numbers of jobs inline
- if args_list.size == 1 && !always_async_project_authorizations_refresh?
- return bulk_perform_inline(args_list)
- end
-
bulk_perform_async(args_list)
end
-
- # Performs multiple jobs directly. Failed jobs will be put into sidekiq so
- # they can benefit from retries
- def bulk_perform_inline(args_list)
- failed = []
-
- args_list.each do |args|
- worker = new
- Gitlab::AppJsonLogger.info(worker.structured_payload(message: 'running inline'))
- worker.perform(*args)
- rescue StandardError
- failed << args
- end
-
- bulk_perform_async(failed) if failed.present?
- end
-
- def always_async_project_authorizations_refresh?
- Feature.enabled?(:always_async_project_authorizations_refresh)
- end
end
def perform(*args)