diff options
Diffstat (limited to 'app/uploaders/records_uploads.rb')
-rw-r--r-- | app/uploaders/records_uploads.rb | 12 |
1 files changed, 2 insertions, 10 deletions
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!) |