summaryrefslogtreecommitdiff
path: root/app/services/ci/pipeline_schedule_service.rb
blob: 596c3b80bda0b339087c5ddeebf8368d47350835 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# 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!
      RunPipelineScheduleWorker.perform_async(schedule.id, schedule.owner&.id)
    end
  end
end