diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-11-08 01:41:38 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-11-08 01:41:38 +0300 |
commit | 52c9c0d60f5752308409d97f927c20cd89986535 (patch) | |
tree | 003bf4fcf83656b5c26f38c39079c1c1971a2a89 /app/models | |
parent | bef19a29175f549c891178a5f3f46f9f8bd24d26 (diff) | |
parent | 46b28842b6a05b0b398bdd75e82a00439ad404b0 (diff) |
Merge branch 'fix-stuck-import-jobs-query-performance-issue' into 'master'
StuckImportJobsWorker query performance optimization
See merge request gitlab-org/gitlab-ce!22879
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/project_import_state.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/project_import_state.rb b/app/models/project_import_state.rb index d59cb43dea4..7126bb66d80 100644 --- a/app/models/project_import_state.rb +++ b/app/models/project_import_state.rb @@ -56,4 +56,17 @@ class ProjectImportState < ActiveRecord::Base end end end + + def mark_as_failed(error_message) + original_errors = errors.dup + sanitized_message = Gitlab::UrlSanitizer.sanitize(error_message) + + fail_op + + update_column(:last_error, sanitized_message) + rescue ActiveRecord::ActiveRecordError => e + Rails.logger.error("Error setting import status to failed: #{e.message}. Original error: #{sanitized_message}") + ensure + @errors = original_errors + end end |