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
host: ENV.fetch('REDIS_HOST') { 'localhost' },
port: ENV.fetch('REDIS_PORT') { 6379 },
db: 0,
- namespace: 'cache'
+ namespace: 'cache',
+ expires_in: 20.minutes
}
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
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