nyastodon/app/workers/scheduler/feed_cleanup_scheduler.rb
Eugen Rochko 34118169ac 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
2017-10-16 20:44:31 +02:00

25 lines
511 B
Ruby

# frozen_string_literal: true
require 'sidekiq-scheduler'
class Scheduler::FeedCleanupScheduler
include Sidekiq::Worker
def perform
redis.pipelined do
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
private
def inactive_users
@inactive_users ||= User.confirmed.inactive.pluck(:account_id)
end
def redis
Redis.current
end
end