mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-06 06:56:22 +00:00
34118169ac
* 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
26 lines
511 B
Ruby
26 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
|