diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-06-18 19:00:14 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-06-18 19:00:14 +0000 |
commit | ba952d53c5782e49b59ba3e5dd89c2c1eca02c80 (patch) | |
tree | d569b1595afd23dac294b09eb5ac67f0ba251390 | |
parent | 2ffd71f8f1e7957ada82733b36a568ab316d60f2 (diff) | |
parent | 36b30cf18e7cf24fbb444eeecca70b719ed3208d (diff) | |
download | gitlab-ce-ba952d53c5782e49b59ba3e5dd89c2c1eca02c80.tar.gz |
Merge branch 'revert-concurrent-pipeline-schedule-creation' into 'master'
Revert concurrent pipeline creation for pipeline schedules
See merge request gitlab-org/gitlab-ce!29794
3 files changed, 49 insertions, 1 deletions
diff --git a/app/services/ci/pipeline_schedule_service.rb b/app/services/ci/pipeline_schedule_service.rb index 5b5e9a26520..ef90d91c936 100644 --- a/app/services/ci/pipeline_schedule_service.rb +++ b/app/services/ci/pipeline_schedule_service.rb @@ -7,7 +7,18 @@ module Ci # Otherwise, multiple pipelines could be created in a short interval. schedule.schedule_next_run! - RunPipelineScheduleWorker.perform_async(schedule.id, schedule.owner&.id) + 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 diff --git a/changelogs/unreleased/revert-concurrent-pipeline-schedule-creation.yml b/changelogs/unreleased/revert-concurrent-pipeline-schedule-creation.yml new file mode 100644 index 00000000000..77423463d22 --- /dev/null +++ b/changelogs/unreleased/revert-concurrent-pipeline-schedule-creation.yml @@ -0,0 +1,5 @@ +--- +title: Revert concurrent pipeline creation for pipeline schedules +merge_request: 29794 +author: +type: fixed diff --git a/spec/services/ci/pipeline_schedule_service_spec.rb b/spec/services/ci/pipeline_schedule_service_spec.rb index 867ed0acc0d..f7590720f66 100644 --- a/spec/services/ci/pipeline_schedule_service_spec.rb +++ b/spec/services/ci/pipeline_schedule_service_spec.rb @@ -25,6 +25,38 @@ describe Ci::PipelineScheduleService do subject end + context 'when ci_pipeline_schedule_async feature flag is disabled' do + before do + stub_feature_flags(ci_pipeline_schedule_async: false) + end + + it 'runs RunPipelineScheduleWorker synchronously' do + expect_next_instance_of(RunPipelineScheduleWorker) do |worker| + expect(worker).to receive(:perform).with(schedule.id, schedule.owner.id) + end + + subject + end + + it 'calls Garbage Collection manually' do + expect(GC).to receive(:start) + + subject + end + + context 'when ci_pipeline_schedule_force_gc feature flag is disabled' do + before do + stub_feature_flags(ci_pipeline_schedule_force_gc: false) + end + + it 'does not call Garbage Collection manually' do + expect(GC).not_to receive(:start) + + subject + end + end + end + context 'when owner is nil' do let(:schedule) { create(:ci_pipeline_schedule, project: project, owner: nil) } |