gitlab-org--gitlab-foss/app/services/ci/pipeline_schedule_service.rb
Shinya Maeda 36b30cf18e Revert concurrent pipeline schedule creation
This commit reverts the previously introduced concurrent pipeline
schedule creation which was a viable solution for mitigating
inconsistent pipeline schedule by Sidekiq Memory Killer.
2019-06-18 21:56:11 +07:00

24 lines
849 B
Ruby

# 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!
if Feature.enabled?(:ci_pipeline_schedule_async)
RunPipelineScheduleWorker.perform_async(schedule.id, schedule.owner&.id)
else
begin
RunPipelineScheduleWorker.new.perform(schedule.id, schedule.owner&.id)
ensure
##
# This is the temporary solution for avoiding the memory bloat.
# See more https://gitlab.com/gitlab-org/gitlab-ce/issues/61955
GC.start if Feature.enabled?(:ci_pipeline_schedule_force_gc, default_enabled: true)
end
end
end
end
end