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
8b9f9dbb
Commit
8b9f9dbb
authored
May 07, 2020
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the mergeability check worker idempotent
parent
5c3ddecc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
app/workers/all_queues.yml
app/workers/all_queues.yml
+1
-1
app/workers/merge_request_mergeability_check_worker.rb
app/workers/merge_request_mergeability_check_worker.rb
+2
-1
spec/workers/merge_request_mergeability_check_worker_spec.rb
spec/workers/merge_request_mergeability_check_worker_spec.rb
+11
-0
No files found.
app/workers/all_queues.yml
View file @
8b9f9dbb
...
@@ -1143,7 +1143,7 @@
...
@@ -1143,7 +1143,7 @@
:urgency: :low
:urgency: :low
:resource_boundary: :unknown
:resource_boundary: :unknown
:weight:
1
:weight:
1
:idempotent:
:idempotent:
true
-
:name: migrate_external_diffs
-
:name: migrate_external_diffs
:feature_category: :source_code_management
:feature_category: :source_code_management
:has_external_dependencies:
:has_external_dependencies:
...
...
app/workers/merge_request_mergeability_check_worker.rb
View file @
8b9f9dbb
# frozen_string_literal: true
# frozen_string_literal: true
class
MergeRequestMergeabilityCheckWorker
# rubocop:disable Scalability/IdempotentWorker
class
MergeRequestMergeabilityCheckWorker
include
ApplicationWorker
include
ApplicationWorker
feature_category
:source_code_management
feature_category
:source_code_management
idempotent!
def
perform
(
merge_request_id
)
def
perform
(
merge_request_id
)
merge_request
=
MergeRequest
.
find_by_id
(
merge_request_id
)
merge_request
=
MergeRequest
.
find_by_id
(
merge_request_id
)
...
...
spec/workers/merge_request_mergeability_check_worker_spec.rb
View file @
8b9f9dbb
...
@@ -25,5 +25,16 @@ describe MergeRequestMergeabilityCheckWorker do
...
@@ -25,5 +25,16 @@ describe MergeRequestMergeabilityCheckWorker do
subject
.
perform
(
merge_request
.
id
)
subject
.
perform
(
merge_request
.
id
)
end
end
end
end
it_behaves_like
'an idempotent worker'
do
let
(
:merge_request
)
{
create
(
:merge_request
)
}
let
(
:job_args
)
{
[
merge_request
.
id
]
}
it
'is mergeable'
do
subject
expect
(
merge_request
).
to
be_mergeable
end
end
end
end
end
end
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