summaryrefslogtreecommitdiff
path: root/app/uploaders
diff options
context:
space:
mode:
Diffstat (limited to 'app/uploaders')
-rw-r--r--app/uploaders/file_mover.rb2
-rw-r--r--app/uploaders/records_uploads.rb12
2 files changed, 3 insertions, 11 deletions
diff --git a/app/uploaders/file_mover.rb b/app/uploaders/file_mover.rb
index 12be1e2bb22..7c7953c8a0e 100644
--- a/app/uploaders/file_mover.rb
+++ b/app/uploaders/file_mover.rb
@@ -98,7 +98,7 @@ class FileMover
end
def revert
- Rails.logger.warn("Markdown not updated, file move reverted for #{to_model}")
+ Rails.logger.warn("Markdown not updated, file move reverted for #{to_model}") # rubocop:disable Gitlab/RailsLogger
if temp_file_uploader.file_storage?
FileUtils.move(file_path, temp_file_path)
diff --git a/app/uploaders/records_uploads.rb b/app/uploaders/records_uploads.rb
index 00b51f92b12..967fcdc704e 100644
--- a/app/uploaders/records_uploads.rb
+++ b/app/uploaders/records_uploads.rb
@@ -23,19 +23,11 @@ module RecordsUploads
return unless model
return unless file && file.exists?
- # MySQL InnoDB may encounter a deadlock if a deletion and an
- # insert is in the same transaction due to its next-key locking
- # algorithm, so we need to skip the transaction.
- # https://gitlab.com/gitlab-org/gitlab-ce/issues/55161#note_131556351
- if Gitlab::Database.mysql?
- readd_upload
- else
- Upload.transaction { readd_upload }
- end
+ Upload.transaction { readd_upload }
end
def readd_upload
- uploads.where(path: upload_path).delete_all
+ uploads.where(model: model, path: upload_path).delete_all
upload.delete if upload
self.upload = build_upload.tap(&:save!)