Keep references to all reblogs of a status on home feed (#5419)

* Keep references to all reblogs of a status on home feed

When inserting reblog: Add to set of reblogs of this status on
the feed, if original status was present in the feed, add it to
that set as well.

When removing a reblog: Remove it from that set. Take random
remaining item from the set. If one exists, re-insert it into feed,
otherwise do not re-insert anything.

Fix #4210

* When original is removed, toss out reblog references
This commit is contained in:
Eugen Rochko 2017-10-16 20:44:31 +02:00 committed by GitHub
parent 4fd7aebd5e
commit 34118169ac
3 changed files with 72 additions and 27 deletions

View file

@ -6,8 +6,9 @@ class Scheduler::FeedCleanupScheduler
def perform
redis.pipelined do
inactive_users.pluck(:account_id).each do |account_id|
inactive_users.each do |account_id|
redis.del(FeedManager.instance.key(:home, account_id))
redis.del(FeedManager.instance.key(:home, account_id, 'reblogs'))
end
end
end
@ -15,7 +16,7 @@ class Scheduler::FeedCleanupScheduler
private
def inactive_users
User.confirmed.inactive
@inactive_users ||= User.confirmed.inactive.pluck(:account_id)
end
def redis