Commit ac503dd1 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'mc/backstage/make-pipelineupdateworker-idempotent' into 'master'

Make PipelineUpdateWorker idempotent

Closes #30585 and #216734

See merge request gitlab-org/gitlab!36010
parents cd619bdb 48e71aca
......@@ -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