diff --git a/app/lib/vacuum/preview_cards_vacuum.rb b/app/lib/vacuum/preview_cards_vacuum.rb index 14fdeda1ca9..9e34c87c30c 100644 --- a/app/lib/vacuum/preview_cards_vacuum.rb +++ b/app/lib/vacuum/preview_cards_vacuum.rb @@ -14,9 +14,8 @@ class Vacuum::PreviewCardsVacuum private def vacuum_cached_images! - preview_cards_past_retention_period.find_each do |preview_card| - preview_card.image.destroy - preview_card.save + preview_cards_past_retention_period.find_in_batches do |preview_card| + AttachmentBatch.new(PreviewCard, preview_card).clear end end