Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2018-05-04 20:52:43 +0300
committerJan Provaznik <jprovaznik@gitlab.com>2018-05-16 09:58:07 +0300
commitc81a37c1d3f864cf0a00386dab29da78f222e3a5 (patch)
tree3291747605c9cc08de55f546206679c42616d6e6 /app/models/concerns/with_uploads.rb
parent7da3b2cdd09078984416aa03da108ad0a4a4e477 (diff)
Use find_in_batches instead of destroy_all
destroy_all loads all records at once
Diffstat (limited to 'app/models/concerns/with_uploads.rb')
-rw-r--r--app/models/concerns/with_uploads.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/concerns/with_uploads.rb b/app/models/concerns/with_uploads.rb
index 101d09f161d..3d99889c131 100644
--- a/app/models/concerns/with_uploads.rb
+++ b/app/models/concerns/with_uploads.rb
@@ -32,6 +32,8 @@ module WithUploads
# it can not be done in after_commit because FileUploader requires loads
# associated model on destroy (which is already deleted in after_commit)
def destroy_file_uploads
- self.uploads.where(uploader: FILE_UPLOADERS).destroy_all
+ self.uploads.where(uploader: FILE_UPLOADERS).find_each do |upload|
+ upload.destroy
+ end
end
end