mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-09 16:35:48 +00:00
3249d35bdc
* Delete status records by batches of 50 * Do not precompute values that are only used once * Do not generate redis events for removal of public toots older than two weeks * Filter reported toots a priori for polls and status deletion * Do not process reblogs when cleaning up public timelines As in Mastodon proper, reblogs don't appear in public TLs * Clean the deleted account's own feed in one go * Refactor Account#clean_feed_manager and List#clean_feed_manager * Delete instead of destroy a few more associations * Fix preloading Co-authored-by: Claire <claire.github-309c@sitedethib.com>
36 lines
672 B
Ruby
36 lines
672 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Scheduler::FeedCleanupScheduler
|
|
include Sidekiq::Worker
|
|
include Redisable
|
|
|
|
sidekiq_options lock: :until_executed, retry: 0
|
|
|
|
def perform
|
|
clean_home_feeds!
|
|
clean_list_feeds!
|
|
end
|
|
|
|
private
|
|
|
|
def clean_home_feeds!
|
|
feed_manager.clean_feeds!(:home, inactive_account_ids)
|
|
end
|
|
|
|
def clean_list_feeds!
|
|
feed_manager.clean_feeds!(:list, inactive_list_ids)
|
|
end
|
|
|
|
def inactive_account_ids
|
|
@inactive_account_ids ||= User.confirmed.inactive.pluck(:account_id)
|
|
end
|
|
|
|
def inactive_list_ids
|
|
List.where(account_id: inactive_account_ids).pluck(:id)
|
|
end
|
|
|
|
def feed_manager
|
|
FeedManager.instance
|
|
end
|
|
end
|