Class: Gitlab::GithubImport::AdvanceStageWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker, Import::AdvanceStage
Defined in:
app/workers/gitlab/github_import/advance_stage_worker.rb

Overview

AdvanceStageWorker is a worker used by the GitHub importer to wait for a number of jobs to complete, without blocking a thread. Once all jobs have been completed this worker will advance the import process to the next stage.

Constant Summary collapse

STAGES =

The known importer stages and their corresponding Sidekiq workers.

{
  collaborators: Stage::ImportCollaboratorsWorker,
  pull_requests_merged_by: Stage::ImportPullRequestsMergedByWorker,
  pull_request_review_requests: Stage::ImportPullRequestsReviewRequestsWorker,
  pull_request_reviews: Stage::ImportPullRequestsReviewsWorker,
  issues_and_diff_notes: Stage::ImportIssuesAndDiffNotesWorker,
  issue_events: Stage::ImportIssueEventsWorker,
  notes: Stage::ImportNotesWorker,
  attachments: Stage::ImportAttachmentsWorker,
  protected_branches: Stage::ImportProtectedBranchesWorker,
  lfs_objects: Stage::ImportLfsObjectsWorker,
  finish: Stage::FinishImportWorker
}.freeze

Constants included from Import::AdvanceStage

Import::AdvanceStage::AdvanceStageTimeoutError, Import::AdvanceStage::BLOCKING_WAIT_TIME, Import::AdvanceStage::INTERVAL, Import::AdvanceStage::TIMEOUT_DURATION

Constants included from ApplicationWorker

ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT

Constants included from Loggable

Loggable::ANONYMOUS

Constants included from WorkerAttributes

WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES

Instance Method Summary collapse

Methods included from Import::AdvanceStage

#perform, #wait_for_jobs

Methods included from Loggable

#build_structured_payload

Methods included from SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#find_import_state(id) ⇒ Object



40
41
42
# File 'app/workers/gitlab/github_import/advance_stage_worker.rb', line 40

def find_import_state(id)
  ProjectImportState.find(id)
end

#find_import_state_jid(project_id) ⇒ Object



36
37
38
# File 'app/workers/gitlab/github_import/advance_stage_worker.rb', line 36

def find_import_state_jid(project_id)
  ProjectImportState.jid_by(project_id: project_id, status: :started)
end