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