2019-09-04 21:01:54 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
class PipelineScheduleService < BaseService
|
|
|
|
def execute(schedule)
|
2022-04-04 11:22:00 +05:30
|
|
|
return unless project.persisted?
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
# Ensure `next_run_at` is set properly before creating a pipeline.
|
|
|
|
# Otherwise, multiple pipelines could be created in a short interval.
|
|
|
|
schedule.schedule_next_run!
|
2020-05-24 23:13:21 +05:30
|
|
|
RunPipelineScheduleWorker.perform_async(schedule.id, schedule.owner&.id)
|
2019-09-04 21:01:54 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|