2020-09-29 11:10:08 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class PropagateIntegrationInheritWorker
|
|
|
|
include ApplicationWorker
|
|
|
|
|
2021-07-21 08:09:35 -04:00
|
|
|
data_consistency :always
|
2021-04-30 14:10:09 -04:00
|
|
|
sidekiq_options retry: 3
|
2020-09-29 11:10:08 -04:00
|
|
|
feature_category :integrations
|
2021-07-26 14:09:51 -04:00
|
|
|
urgency :low
|
|
|
|
|
2020-09-29 11:10:08 -04:00
|
|
|
idempotent!
|
|
|
|
|
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
|
|
|
def perform(integration_id, min_id, max_id)
|
2021-05-12 08:10:24 -04:00
|
|
|
integration = Integration.find_by_id(integration_id)
|
2020-09-29 11:10:08 -04:00
|
|
|
return unless integration
|
|
|
|
|
2021-05-12 08:10:24 -04:00
|
|
|
batch = Integration.where(id: min_id..max_id).by_type(integration.type).inherit_from_id(integration.id)
|
2020-09-29 11:10:08 -04:00
|
|
|
|
2020-10-23 14:08:31 -04:00
|
|
|
BulkUpdateIntegrationService.new(integration, batch).execute
|
2020-09-29 11:10:08 -04:00
|
|
|
end
|
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
|
|
|
end
|