Class: JiraConnect::ForwardEventWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker
Defined in:
app/workers/jira_connect/forward_event_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

Gitlab::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 Gitlab::Loggable

#build_structured_payload

Methods included from Gitlab::SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#perform(installation_id, base_path, event_path) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/workers/jira_connect/forward_event_worker.rb', line 14

def perform(installation_id, base_path, event_path)
  installation = JiraConnectInstallation.find_by_id(installation_id)
  instance_url = installation&.instance_url

  installation.destroy if installation

  return if instance_url.nil?

  proxy_url = instance_url + event_path
  qsh = Atlassian::Jwt.create_query_string_hash(proxy_url, 'POST', instance_url + base_path)
  jwt = Atlassian::Jwt.encode({ iss: installation.client_key, qsh: qsh }, installation.shared_secret)

  JiraConnect::RetryRequestWorker.perform_async(proxy_url, jwt)
end