Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
48e71aca
Commit
48e71aca
authored
Jul 05, 2020
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make PipelineUpdateWorker idempotent
parent
d9aca16a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
app/workers/all_queues.yml
app/workers/all_queues.yml
+1
-1
app/workers/pipeline_update_worker.rb
app/workers/pipeline_update_worker.rb
+3
-1
spec/workers/pipeline_update_worker_spec.rb
spec/workers/pipeline_update_worker_spec.rb
+8
-0
No files found.
app/workers/all_queues.yml
View file @
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
...
...
app/workers/pipeline_update_worker.rb
View file @
48e71aca
# 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
...
...
spec/workers/pipeline_update_worker_spec.rb
View file @
48e71aca
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment