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