Class: Gitlab::JiraImport::ImportIssueWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker, Import::DatabaseHelpers, Import::NotifyUponDeath, QueueOptions
Defined in:
app/workers/gitlab/jira_import/import_issue_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 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::DatabaseHelpers

#insert_and_return_id

Methods included from Loggable

#build_structured_payload

Methods included from SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#perform(project_id, jira_issue_id, issue_attributes, waiter_key) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/workers/gitlab/jira_import/import_issue_worker.rb', line 17

def perform(project_id, jira_issue_id, issue_attributes, waiter_key)
  create_issue(issue_attributes, project_id)
rescue StandardError => ex
  # Todo: Record jira issue id(or better jira issue key),
  # so that we can report the list of failed to import issues to the user
  # see https://gitlab.com/gitlab-org/gitlab/-/issues/211653
  #
  # It's possible the project has been deleted since scheduling this
  # job. In this case we'll just skip creating the issue.
  Gitlab::ErrorTracking.track_exception(ex, project_id: project_id)
  JiraImport.increment_issue_failures(project_id)
ensure
  # ensure we notify job waiter that the job has finished
  JobWaiter.notify(waiter_key, jid, ttl: Gitlab::Import::JOB_WAITER_TTL) if waiter_key
end