Class: Gitlab::BitbucketImport::Importers::IssuesImporter
- Inherits:
-
Object
- Object
- Gitlab::BitbucketImport::Importers::IssuesImporter
- Includes:
- ParallelScheduling
- Defined in:
- lib/gitlab/bitbucket_import/importers/issues_importer.rb
Constant Summary
Constants included from ParallelScheduling
ParallelScheduling::ALREADY_ENQUEUED_CACHE_KEY, ParallelScheduling::BATCH_SIZE, ParallelScheduling::JOB_WAITER_CACHE_KEY
Instance Attribute Summary
Attributes included from ParallelScheduling
#already_enqueued_cache_key, #job_waiter_cache_key, #project
Instance Method Summary collapse
Methods included from ParallelScheduling
Methods included from ErrorTracking
Methods included from Loggable
#log_debug, #log_error, #log_info, #log_warn
Instance Method Details
#execute ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gitlab/bitbucket_import/importers/issues_importer.rb', line 9 def execute log_info(import_stage: 'import_issues', message: 'importing issues') issues = client.issues(project.import_source) labels = build_labels_hash issues.each do |issue| job_waiter.jobs_remaining += 1 next if already_enqueued?(issue) job_delay = calculate_job_delay(job_waiter.jobs_remaining) issue_hash = issue.to_hash.merge({ issue_type_id: default_issue_type_id, label_id: labels[issue.kind] }) sidekiq_worker_class.perform_in(job_delay, project.id, issue_hash, job_waiter.key) mark_as_enqueued(issue) end job_waiter rescue StandardError => e track_import_failure!(project, exception: e) end |