2017-05-20 10:42:58 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
require 'sidekiq-scheduler'
|
|
|
|
|
|
|
|
class Scheduler::FeedCleanupScheduler
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
|
|
|
def perform
|
|
|
|
redis.pipelined do
|
2017-10-16 11:44:31 -07:00
|
|
|
inactive_users.each do |account_id|
|
2017-05-20 10:42:58 -07:00
|
|
|
redis.del(FeedManager.instance.key(:home, account_id))
|
2017-10-16 11:44:31 -07:00
|
|
|
redis.del(FeedManager.instance.key(:home, account_id, 'reblogs'))
|
2017-05-20 10:42:58 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def inactive_users
|
2017-10-16 11:44:31 -07:00
|
|
|
@inactive_users ||= User.confirmed.inactive.pluck(:account_id)
|
2017-05-20 10:42:58 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
def redis
|
|
|
|
Redis.current
|
|
|
|
end
|
|
|
|
end
|