mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-12-05 02:09:03 +01:00
ae62e5fa53
* fix(status): remove send usage for private unlink_from_conversations - make unlink_from_conversations public method - rename unlink_from_conversations to unlink_from_conversations! - fix send call on private method in statuses_vacuum and batched_remove_status_service * fix(feeds_vacuum): replace find_in_batches with in_batches because active record query results should be a little more efficient than itterating with map and each. Postgres can grasp such lists of ids much quicker than ruby can. Will probably make allmost no difference, but cannot hurt either.
34 lines
698 B
Ruby
34 lines
698 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Vacuum::FeedsVacuum
|
|
def perform
|
|
vacuum_inactive_home_feeds!
|
|
vacuum_inactive_list_feeds!
|
|
end
|
|
|
|
private
|
|
|
|
def vacuum_inactive_home_feeds!
|
|
inactive_users.select(:id, :account_id).in_batches do |users|
|
|
feed_manager.clean_feeds!(:home, users.pluck(:account_id))
|
|
end
|
|
end
|
|
|
|
def vacuum_inactive_list_feeds!
|
|
inactive_users_lists.select(:id).in_batches do |lists|
|
|
feed_manager.clean_feeds!(:list, lists.ids)
|
|
end
|
|
end
|
|
|
|
def inactive_users
|
|
User.confirmed.inactive
|
|
end
|
|
|
|
def inactive_users_lists
|
|
List.where(account_id: inactive_users.select(:account_id))
|
|
end
|
|
|
|
def feed_manager
|
|
FeedManager.instance
|
|
end
|
|
end
|