Module: Gitlab::BitbucketServerImport::ObjectImporter

Extended by:
ActiveSupport::Concern
Included in:
ImportLfsObjectWorker, ImportPullRequestNoteWorker, ImportPullRequestWorker
Defined in:
app/workers/concerns/gitlab/bitbucket_server_import/object_importer.rb

Overview

ObjectImporter defines the base behaviour for every Sidekiq worker that imports a single resource such as a note or pull request.

Constant Summary collapse

FAILED_IMPORT_STATES =
%w[canceled failed].freeze

Instance Method Summary collapse

Instance Method Details

#perform(project_id, hash, notify_key) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/workers/concerns/gitlab/bitbucket_server_import/object_importer.rb', line 33

def perform(project_id, hash, notify_key)
  project = Project.find_by_id(project_id)

  return unless project

  import_state = project.import_status

  if FAILED_IMPORT_STATES.include?(import_state)
    info(project.id, message: "project import #{import_state}")
    return
  end

  import(project, hash)
ensure
  notify_waiter(notify_key)
end