Commit a8015e1b authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'sy-add-index-for-rotation-start-end' into 'master'

Enqueue shift persistence jobs for rotations in batches

See merge request gitlab-org/gitlab!55926
parents 4cb7ce5d 339b06a4
......@@ -2,6 +2,8 @@
module IncidentManagement
class OncallRotation < ApplicationRecord
include EachBatch
ActivePeriod = Struct.new(:start_time, :end_time) do
def present?
start_time && end_time
......
......@@ -15,8 +15,10 @@ module IncidentManagement
queue_namespace :cronjob
def perform
IncidentManagement::OncallRotation.in_progress.pluck(:id).each do |rotation_id| # rubocop: disable CodeReuse/ActiveRecord
IncidentManagement::OncallRotations::PersistShiftsJob.perform_async(rotation_id)
IncidentManagement::OncallRotation.each_batch do |rotations|
rotations.in_progress.ids.each do |id| # rubocop: disable CodeReuse/ActiveRecord
IncidentManagement::OncallRotations::PersistShiftsJob.perform_async(id)
end
end
end
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