PERF: Speed up migrate_to_s3 rake task by deleting optimized image record.

No point moving all optimized image files to tombstone when the store is
changing. Also, `destroy_all` can easily blow memory since we are no
loading in batches.
This commit is contained in:
Guo Xiang Tan 2019-05-07 16:08:50 +08:00
parent e4abc51866
commit 2adbec1b3c
1 changed files with 1 additions and 1 deletions

View File

@ -421,7 +421,7 @@ def migrate_to_s3
OptimizedImage
.joins("LEFT JOIN uploads u ON optimized_images.upload_id = u.id")
.where("u.id IS NOT NULL AND u.url LIKE '//%' AND optimized_images.url NOT LIKE '//%'")
.destroy_all
.delete_all
puts "Rebaking posts with lightboxes..."