about summary refs log tree commit diff
path: root/app/workers/scheduler/feed_cleanup_scheduler.rb
blob: dbebaa2c38d088e6dcc963d740daf90a9db574cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true
require 'sidekiq-scheduler'

class Scheduler::FeedCleanupScheduler
  include Sidekiq::Worker

  def perform
    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
    User.confirmed.inactive
  end

  def redis
    Redis.current
  end
end