Commit 48e71aca authored by Matija Čupić's avatar Matija Čupić

Make PipelineUpdateWorker idempotent

parent d9aca16a
......@@ -1018,7 +1018,7 @@
:urgency: :high
:resource_boundary: :unknown
:weight: 5
:idempotent:
:idempotent: true
:tags: []
- :name: pipeline_processing:stage_update
:feature_category: :continuous_integration
......
# frozen_string_literal: true
class PipelineUpdateWorker # rubocop:disable Scalability/IdempotentWorker
class PipelineUpdateWorker
include ApplicationWorker
include PipelineQueue
queue_namespace :pipeline_processing
urgency :high
idempotent!
def perform(pipeline_id)
Ci::Pipeline.find_by_id(pipeline_id)&.update_legacy_status
end
......
......@@ -12,6 +12,14 @@ RSpec.describe PipelineUpdateWorker do
described_class.new.perform(pipeline.id)
end
include_examples 'an idempotent worker' do
let(:job_args) { [pipeline.id] }
it 'sets pipeline status to skipped' do
expect { subject }.to change { pipeline.reload.status }.from('pending').to('skipped')
end
end
end
context 'when pipeline does not exist' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment