From afc8550b63434232bb06b196132f2a180516061b Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 11 Dec 2023 01:49:10 -0600 Subject: [PATCH] Change preview card deletes to be done using batch method (#28183) --- app/lib/vacuum/preview_cards_vacuum.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/lib/vacuum/preview_cards_vacuum.rb b/app/lib/vacuum/preview_cards_vacuum.rb index 14fdeda1ca..9e34c87c30 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