Only distribute statuses to followers who signed in in the last 2 weeks, add rake task for clearing feeds of inactive users

This commit is contained in:
Eugen Rochko 2016-11-24 18:17:58 +01:00
parent 7baca3fe4d
commit 4f1d863615
3 changed files with 12 additions and 3 deletions

View file

@ -24,7 +24,7 @@ class FanOutOnWriteService < BaseService
def deliver_to_followers(status)
Rails.logger.debug "Delivering status #{status.id} to followers"
status.account.followers.where(domain: nil).find_each do |follower|
status.account.followers.where(domain: nil).joins(:user).where('users.current_sign_in_at > ?', 14.days.ago).find_each do |follower|
next if FeedManager.instance.filter?(:home, status, follower)
FeedManager.instance.push(:home, follower, status)
end