debian-mirror-gitlab/app/services/ci/pipeline_schedule_service.rb
2022-04-04 11:22:00 +05:30

14 lines
433 B
Ruby

# frozen_string_literal: true
module Ci
class PipelineScheduleService < BaseService
def execute(schedule)
return unless project.persisted?
# 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