2019-05-17 08:10:44 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
class PipelineScheduleService < BaseService
|
|
|
|
def execute(schedule)
|
|
|
|
# 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-07 05:09:51 -04:00
|
|
|
RunPipelineScheduleWorker.perform_async(schedule.id, schedule.owner&.id)
|
2019-05-17 08:10:44 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|