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:
		@@ -36,8 +36,16 @@ namespace :mastodon do
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  namespace :feeds do
 | 
			
		||||
    desc 'Clears all timelines so that they would be regenerated on next hit'
 | 
			
		||||
    desc 'Clear timelines of inactive users'
 | 
			
		||||
    task clear: :environment do
 | 
			
		||||
      User.where('current_sign_in_at < ?', 14.days.ago).find_each do |user|
 | 
			
		||||
        Redis.current.del(FeedManager.instance.key(:home, user.account_id))
 | 
			
		||||
        Redis.current.del(FeedManager.instance.key(:mentions, user.account_id))
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    desc 'Clears all timelines so that they would be regenerated on next hit'
 | 
			
		||||
    task clear_all: :environment do
 | 
			
		||||
      Redis.current.keys('feed:*').each { |key| Redis.current.del(key) }
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user