Commit 339b06a4 authored by syasonik's avatar syasonik Committed by Adam Hegyi

Allow shift persistence for rotations to scale

parent f746aadb
......@@ -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