Change preview card deletes to be done using batch method (#28183)

This commit is contained in:
Michael Stanclift 2023-12-11 01:49:10 -06:00 committed by GitHub
parent 490e4969a1
commit afc8550b63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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