Fix vacuums being interrupted by a single batch failure (#36606)

This commit is contained in:
Eugen Rochko authored and GitHub committed 2025-10-27 14:22:54 +00:00
1 parent b60bae6361
commit bfcf21e915
2 files changed
+6

No files matched your search

@@ -17,12 +17,16 @@ class Vacuum::MediaAttachmentsVacuum
def vacuum_cached_files!
media_attachments_past_retention_period.find_in_batches do |media_attachments|
AttachmentBatch.new(MediaAttachment, media_attachments).clear
rescue => e
Rails.logger.error("Skipping batch while removing cached media attachments due to error: #{e}")
end
end
def vacuum_orphaned_records!
orphaned_media_attachments.find_in_batches do |media_attachments|
AttachmentBatch.new(MediaAttachment, media_attachments).delete
rescue => e
Rails.logger.error("Skipping batch while removing orphaned media attachments due to error: #{e}")
end
end
+2
View File
@@ -16,6 +16,8 @@ class Vacuum::PreviewCardsVacuum
def vacuum_cached_images!
preview_cards_past_retention_period.find_in_batches do |preview_card|
AttachmentBatch.new(PreviewCard, preview_card).clear
rescue => e
Rails.logger.error("Skipping batch while removing cached preview cards due to error: #{e}")
end
end