diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-05-17 19:10:44 +0700 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-06-03 10:04:57 +0700 |
commit | 6a18a411a30e9e7406ba9335ab502ec396add662 (patch) | |
tree | 423c290a2382010561784917effc38d944fdf579 /spec/services | |
parent | 96744d0befd7e298c08e6d20a4f504086a717c35 (diff) | |
download | gitlab-ce-6a18a411a30e9e7406ba9335ab502ec396add662.tar.gz |
Make pipeline schedule worker resilientset-real-next-run-at-for-preventing-duplciate-pipeline-creations
Currently, pipeline schedule worker is unstable because it's
sometimes killed by excessive memory consumption.
In order to improve the performance, we add the following fixes:
1. next_run_at is always real_next_run, which means the value
always takes into account of worker's cron schedule
1. Remove exlusive lock. This is already covered by real_next_run
change.
1. Use RunPipelineScheduleWorker for avoiding memory killer.
Memory consumption is spread to the multiple sidekiq worker.
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/ci/pipeline_schedule_service_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/services/ci/pipeline_schedule_service_spec.rb b/spec/services/ci/pipeline_schedule_service_spec.rb new file mode 100644 index 00000000000..f2ac53cb25a --- /dev/null +++ b/spec/services/ci/pipeline_schedule_service_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Ci::PipelineScheduleService do + let(:project) { create(:project) } + let(:user) { create(:user) } + let(:service) { described_class.new(project, user) } + + describe '#execute' do + subject { service.execute(schedule) } + + let(:schedule) { create(:ci_pipeline_schedule, project: project, owner: user) } + + it 'schedules next run' do + expect(schedule).to receive(:schedule_next_run!) + + subject + end + + it 'runs RunPipelineScheduleWorker' do + expect(RunPipelineScheduleWorker) + .to receive(:perform_async).with(schedule.id, schedule.owner.id) + + subject + end + end +end |