From 34118169ace56b31d6d4b26638fb7375171b7796 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 16 Oct 2017 20:44:31 +0200 Subject: 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 --- app/workers/scheduler/feed_cleanup_scheduler.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/workers/scheduler/feed_cleanup_scheduler.rb') diff --git a/app/workers/scheduler/feed_cleanup_scheduler.rb b/app/workers/scheduler/feed_cleanup_scheduler.rb index dbebaa2c3..222f5ed84 100644 --- a/app/workers/scheduler/feed_cleanup_scheduler.rb +++ b/app/workers/scheduler/feed_cleanup_scheduler.rb @@ -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 -- cgit