2022-09-27 03:08:19 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Vacuum::FeedsVacuum
|
|
|
|
def perform
|
|
|
|
vacuum_inactive_home_feeds!
|
|
|
|
vacuum_inactive_list_feeds!
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def vacuum_inactive_home_feeds!
|
2023-01-11 21:57:24 +01:00
|
|
|
inactive_users.select(:id, :account_id).in_batches do |users|
|
|
|
|
feed_manager.clean_feeds!(:home, users.pluck(:account_id))
|
2022-09-27 03:08:19 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def vacuum_inactive_list_feeds!
|
2023-01-11 21:57:24 +01:00
|
|
|
inactive_users_lists.select(:id).in_batches do |lists|
|
|
|
|
feed_manager.clean_feeds!(:list, lists.ids)
|
2022-09-27 03:08:19 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def inactive_users
|
2024-04-08 15:53:49 +02:00
|
|
|
User.confirmed.not_signed_in_recently
|
2022-09-27 03:08:19 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def inactive_users_lists
|
|
|
|
List.where(account_id: inactive_users.select(:account_id))
|
|
|
|
end
|
|
|
|
|
|
|
|
def feed_manager
|
|
|
|
FeedManager.instance
|
|
|
|
end
|
|
|
|
end
|