diff options
author | nicolas <nclm@users.noreply.github.com> | 2016-11-24 20:13:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-24 20:13:30 +0100 |
commit | 60577f4c6ee9f4a4c9af0a41a8954e19a5f2c8cf (patch) | |
tree | 8c661ea7ceaff780965631c530ca065805c1861d /lib | |
parent | 5e33445c5ff9ded56c2d40eb17d89ace108c3840 (diff) | |
parent | 8e34bed7cce7b97388e55fabacee7d424b5846ea (diff) |
Merge branch 'master' into french-translation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/mastodon.rake | 10 |
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 |