As a regression from the recent optimizations, mentions were left untouched
until `account.destroy`, which would then delete them individually,
and executing queries to find and delete associated notifications, resulting
in a massive slowdown.
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
purge_user!
purge_profile!
purge_statuses!
+ purge_mentions!
purge_media_attachments!
purge_polls!
purge_generated_notifications!
end
end
+ def purge_mentions!
+ @account.mentions.reorder(nil).where.not(status_id: reported_status_ids).in_batches.delete_all
+ end
+
def purge_media_attachments!
@account.media_attachments.reorder(nil).find_each do |media_attachment|
next if keep_account_record? && reported_status_ids.include?(media_attachment.status_id)