diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2018-05-04 19:52:43 +0200 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2018-05-16 08:58:07 +0200 |
commit | c81a37c1d3f864cf0a00386dab29da78f222e3a5 (patch) | |
tree | 3291747605c9cc08de55f546206679c42616d6e6 /app | |
parent | 7da3b2cdd09078984416aa03da108ad0a4a4e477 (diff) | |
download | gitlab-ce-c81a37c1d3f864cf0a00386dab29da78f222e3a5.tar.gz |
Use find_in_batches instead of destroy_all
destroy_all loads all records at once
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/with_uploads.rb | 4 |
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 |