debian-mirror-gitlab/app/workers/propagate_integration_inherit_worker.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
623 B
Ruby
Raw Normal View History

2021-01-03 14:25:43 +05:30
# frozen_string_literal: true
class PropagateIntegrationInheritWorker
include ApplicationWorker
2021-10-27 15:23:28 +05:30
data_consistency :always
2021-06-08 01:23:25 +05:30
sidekiq_options retry: 3
2021-01-03 14:25:43 +05:30
feature_category :integrations
2021-10-27 15:23:28 +05:30
urgency :low
2021-01-03 14:25:43 +05:30
idempotent!
# rubocop: disable CodeReuse/ActiveRecord
def perform(integration_id, min_id, max_id)
2021-06-08 01:23:25 +05:30
integration = Integration.find_by_id(integration_id)
2021-01-03 14:25:43 +05:30
return unless integration
2021-06-08 01:23:25 +05:30
batch = Integration.where(id: min_id..max_id).by_type(integration.type).inherit_from_id(integration.id)
2021-01-03 14:25:43 +05:30
2021-01-29 00:20:46 +05:30
BulkUpdateIntegrationService.new(integration, batch).execute
2021-01-03 14:25:43 +05:30
end
# rubocop: enable CodeReuse/ActiveRecord
end