Commit a71ec1a7 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'service-each-batch' into 'master'

Use each_batch instead of in_batches

See merge request gitlab-org/gitlab!45934
parents b01ff4b4 6d6b178c
......@@ -8,6 +8,7 @@ class Service < ApplicationRecord
include ProjectServicesLoggable
include DataFields
include FromUnion
include EachBatch
SERVICE_NAMES = %w[
alerts asana assembla bamboo bugzilla buildkite campfire confluence custom_issue_tracker discord
......@@ -294,7 +295,7 @@ class Service < ApplicationRecord
end
def initialize_properties
self.properties = {} if properties.nil?
self.properties = {} if has_attribute?(:properties) && properties.nil?
end
def title
......
......@@ -20,7 +20,7 @@ module Admin
# rubocop: disable Cop/InBatches
def update_inherited_integrations
Service.by_type(integration.type).inherit_from_id(integration.id).in_batches(of: BATCH_SIZE) do |services|
Service.by_type(integration.type).inherit_from_id(integration.id).each_batch(of: BATCH_SIZE) do |services|
min_id, max_id = services.pick("MIN(services.id), MAX(services.id)")
PropagateIntegrationInheritWorker.perform_async(integration.id, min_id, max_id)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment