2021-01-06 12:10:58 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module JiraConnect
|
2021-07-09 18:09:51 +00:00
|
|
|
class SyncDeploymentsWorker # rubocop:disable Scalability/IdempotentWorker
|
2021-01-06 12:10:58 +00:00
|
|
|
include ApplicationWorker
|
|
|
|
|
2021-04-30 18:10:09 +00:00
|
|
|
sidekiq_options retry: 3
|
|
|
|
|
2021-01-06 12:10:58 +00:00
|
|
|
queue_namespace :jira_connect
|
|
|
|
feature_category :integrations
|
2021-07-09 18:09:51 +00:00
|
|
|
data_consistency :delayed, feature_flag: :load_balancing_for_jira_connect_workers
|
2021-05-03 09:10:02 +00:00
|
|
|
tags :exclude_from_kubernetes
|
2021-01-06 12:10:58 +00:00
|
|
|
|
2021-07-09 18:09:51 +00:00
|
|
|
worker_has_external_dependencies!
|
|
|
|
|
2021-01-06 12:10:58 +00:00
|
|
|
def perform(deployment_id, sequence_id)
|
|
|
|
deployment = Deployment.find_by_id(deployment_id)
|
|
|
|
|
|
|
|
return unless deployment
|
|
|
|
|
|
|
|
::JiraConnect::SyncService
|
|
|
|
.new(deployment.project)
|
|
|
|
.execute(deployments: [deployment], update_sequence_id: sequence_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.perform_async(id)
|
|
|
|
seq_id = ::Atlassian::JiraConnect::Client.generate_update_sequence_id
|
|
|
|
super(id, seq_id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|