You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
478 B

  1. # frozen_string_literal: true
  2. require 'sidekiq-scheduler'
  3. class Scheduler::FeedCleanupScheduler
  4. include Sidekiq::Worker
  5. def perform
  6. logger.info 'Cleaning out home feeds of inactive users'
  7. redis.pipelined do
  8. inactive_users.pluck(:account_id).each do |account_id|
  9. redis.del(FeedManager.instance.key(:home, account_id))
  10. end
  11. end
  12. end
  13. private
  14. def inactive_users
  15. User.confirmed.inactive
  16. end
  17. def redis
  18. Redis.current
  19. end
  20. end