about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-24 18:17:58 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-24 18:17:58 +0100
commit4f1d8636154d8f445eadec5ce3906f06324b0176 (patch)
tree7c044c73bc462af98ce2740848c41d8e4f54a40c /lib
parent7baca3fe4d4b3279236f0004c867bcd2f5bc8849 (diff)
Only distribute statuses to followers who signed in in the last 2 weeks, add rake task for clearing feeds of inactive users
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/mastodon.rake10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index 58bafff66..93461bd0a 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -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