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