This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2017-05-20 10:42:58 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
require 'sidekiq-scheduler'
|
|
|
|
|
|
|
|
class Scheduler::FeedCleanupScheduler
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
|
|
|
def perform
|
|
|
|
logger.info 'Cleaning out home feeds of inactive users'
|
|
|
|
|
|
|
|
redis.pipelined do
|
|
|
|
inactive_users.pluck(:account_id).each do |account_id|
|
|
|
|
redis.del(FeedManager.instance.key(:home, account_id))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def inactive_users
|
2017-05-22 10:36:21 -07:00
|
|
|
User.confirmed.inactive
|
2017-05-20 10:42:58 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
def redis
|
|
|
|
Redis.current
|
|
|
|
end
|
|
|
|
end
|