2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ImportIssuesCsvWorker
|
|
|
|
include ApplicationWorker
|
|
|
|
|
2019-12-21 20:55:43 +05:30
|
|
|
feature_category :issue_tracking
|
2019-12-26 22:10:19 +05:30
|
|
|
worker_resource_boundary :cpu
|
2019-12-21 20:55:43 +05:30
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
sidekiq_retries_exhausted do |job|
|
|
|
|
Upload.find(job['args'][2]).destroy
|
|
|
|
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)
|
|
|
|
|
2019-12-21 20:55:43 +05:30
|
|
|
importer = Issues::ImportCsvService.new(@user, @project, @upload.retrieve_uploader)
|
2019-02-15 15:39:39 +05:30
|
|
|
importer.execute
|
|
|
|
|
|
|
|
@upload.destroy
|
|
|
|
end
|
|
|
|
end
|