Duplicate issues created when importing from CSV
Summary
(Summarize the bug encountered concisely)
Importing issues via the CSV import results in duplicate issues being created.
Steps to reproduce
(How one can reproduce the issue - this is very important)
- Create a new project
- Import a list issues (ex: demosys-users-reb-largeco-sector-alpha-lob-1-app-a-app-a-frontend_issues_2020-06-02.csv)
- Notice duplicate issues in the issue list
Example Project
(If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report)
(If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version)
What is the current bug behavior?
(What actually happens)
Duplicate issues are created upon import
What is the expected correct behavior?
(What you should see instead)
Only one of each issue in the CSV is created
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise.)
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
.com
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
I found out that we have some network issues right now which have caused an increase in these timeouts: gitlab-com/gl-infra/infrastructure#10237.I'll create an MR to move the email sending into its own job so that only that part gets retried when sending fails.
diff --git a/app/services/issues/import_csv_service.rb b/app/services/issues/import_csv_service.rb
index c01db5fcfe6..60790ba3547 100644
--- a/app/services/issues/import_csv_service.rb
+++ b/app/services/issues/import_csv_service.rb
@@ -46,7 +46,7 @@ module Issues
end
def email_results_to_user
- Notify.import_issues_csv_email(@user.id, @project.id, @results).deliver_now
+ Notify.import_issues_csv_email(@user.id, @project.id, @results).deliver_later
end
def detect_col_sep(header)