2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 13:09:10 -05:00
|
|
|
class PipelineScheduleWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2021-04-30 14:10:09 -04:00
|
|
|
|
2021-07-21 08:09:35 -04:00
|
|
|
data_consistency :always
|
|
|
|
|
2020-02-11 19:09:00 -05:00
|
|
|
include CronjobQueue
|
2019-04-27 23:27:08 -04:00
|
|
|
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category :continuous_integration
|
2019-10-30 11:14:17 -04:00
|
|
|
worker_resource_boundary :cpu
|
2019-10-18 07:11:44 -04:00
|
|
|
|
2017-05-07 18:35:56 -04:00
|
|
|
def perform
|
2019-05-17 08:10:44 -04:00
|
|
|
Ci::PipelineSchedule.runnable_schedules.preloaded.find_in_batches do |schedules|
|
|
|
|
schedules.each do |schedule|
|
2022-01-28 07:17:26 -05:00
|
|
|
next unless schedule.project
|
|
|
|
|
2020-02-11 19:09:00 -05:00
|
|
|
with_context(project: schedule.project, user: schedule.owner) do
|
|
|
|
Ci::PipelineScheduleService.new(schedule.project, schedule.owner).execute(schedule)
|
|
|
|
end
|
2019-04-27 23:27:08 -04:00
|
|
|
end
|
2017-05-07 18:35:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|