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
9adb90fa
Commit
9adb90fa
authored
Nov 16, 2020
by
Eugenia Grieff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make ImportIssuesCsvWorker idempotent
- update specs - update all_queues_yml
parent
651e8d4b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
9 deletions
+21
-9
app/workers/all_queues.yml
app/workers/all_queues.yml
+1
-1
app/workers/import_issues_csv_worker.rb
app/workers/import_issues_csv_worker.rb
+8
-5
changelogs/unreleased/make-import-issues-csv-worker-idempotent.yml
...s/unreleased/make-import-issues-csv-worker-idempotent.yml
+5
-0
spec/workers/import_issues_csv_worker_spec.rb
spec/workers/import_issues_csv_worker_spec.rb
+7
-3
No files found.
app/workers/all_queues.yml
View file @
9adb90fa
...
...
@@ -1609,7 +1609,7 @@
:urgency: :low
:resource_boundary: :cpu
:weight:
2
:idempotent:
:idempotent:
true
:tags: []
-
:name: invalid_gpg_signature_update
:feature_category: :source_code_management
...
...
app/workers/import_issues_csv_worker.rb
View file @
9adb90fa
...
...
@@ -3,6 +3,7 @@
class
ImportIssuesCsvWorker
# rubocop:disable Scalability/IdempotentWorker
include
ApplicationWorker
idempotent!
feature_category
:issue_tracking
worker_resource_boundary
:cpu
weight
2
...
...
@@ -12,13 +13,15 @@ class ImportIssuesCsvWorker # rubocop:disable Scalability/IdempotentWorker
end
def
perform
(
current_user_id
,
project_id
,
upload_id
)
@
user
=
User
.
find
(
current_user_id
)
@
project
=
Project
.
find
(
project_id
)
@
upload
=
Upload
.
find
(
upload_id
)
user
=
User
.
find
(
current_user_id
)
project
=
Project
.
find
(
project_id
)
upload
=
Upload
.
find
(
upload_id
)
importer
=
Issues
::
ImportCsvService
.
new
(
@user
,
@project
,
@
upload
.
retrieve_uploader
)
importer
=
Issues
::
ImportCsvService
.
new
(
user
,
project
,
upload
.
retrieve_uploader
)
importer
.
execute
@upload
.
destroy
upload
.
destroy
rescue
ActiveRecord
::
RecordNotFound
# Resources have been removed, job should not be retried
end
end
changelogs/unreleased/make-import-issues-csv-worker-idempotent.yml
0 → 100644
View file @
9adb90fa
---
title
:
Make ImportIssuesCsvWorker idempotent
merge_request
:
47808
author
:
type
:
changed
spec/workers/import_issues_csv_worker_spec.rb
View file @
9adb90fa
...
...
@@ -3,9 +3,9 @@
require
'spec_helper'
RSpec
.
describe
ImportIssuesCsvWorker
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:upload
)
{
create
(
:upload
)
}
let
_it_be
(
:project
)
{
create
(
:project
)
}
let
_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:upload
)
{
create
(
:upload
,
:with_file
)
}
let
(
:worker
)
{
described_class
.
new
}
...
...
@@ -19,5 +19,9 @@ RSpec.describe ImportIssuesCsvWorker do
expect
{
upload
.
reload
}.
to
raise_error
ActiveRecord
::
RecordNotFound
end
it_behaves_like
'an idempotent worker'
do
let
(
:job_args
)
{
[
user
.
id
,
project
.
id
,
upload
.
id
]
}
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