mirror of
https://github.com/mastodon/mastodon.git
synced 2025-12-17 09:33:16 +00:00
Fix vacuums being interrupted by a single batch failure (#36606)
This commit is contained in:
parent
b60bae6361
commit
bfcf21e915
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user