Class: RepositoryImportWorker
- Inherits:
-
Object
- Object
- RepositoryImportWorker
- Includes:
- ApplicationWorker, ExceptionBacktrace, ProjectStartImport, Sidekiq::InterruptionsExhausted
- Defined in:
- app/workers/repository_import_worker.rb
Overview
rubocop:disable Scalability/IdempotentWorker
Constant Summary
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_CONCURRENCY_LIMIT_PERCENTAGE_BY_URGENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY_PER_DB, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::LOAD_BALANCED_DATA_CONSISTENCIES, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
Methods included from ProjectStartImport
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform(project_id) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/workers/repository_import_worker.rb', line 22 def perform(project_id) Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/464677') @project = Project.find_by_id(project_id) return if project.nil? || !start_import? Gitlab::Metrics.add_event(:import_repository) service = Projects::ImportService.new(project, project.creator) result = service.execute # Some importers may perform their work asynchronously. In this case it's up # to those importers to mark the import process as complete. return if service.async? if result[:status] == :error project.reset_counters_and_iids fail_import(result[:message]) else project.after_import end end |
#perform_failure(project_id) ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'app/workers/repository_import_worker.rb', line 45 def perform_failure(project_id) @project = Project.find_by_id(project_id) import_export_upload = @project.import_export_uploads.find_by_user_id(project.creator.id) fail_import('Import process reached the maximum number of interruptions') ::Gitlab::Import::RemoveImportFileWorker.perform_async(import_export_upload.id) end |