mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
ef900789bc
sidekiq-scheduler jobs Resolves #2495
26 lines
514 B
Ruby
26 lines
514 B
Ruby
# 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
|
|
User.confirmed.where('current_sign_in_at < ?', 14.days.ago)
|
|
end
|
|
|
|
def redis
|
|
Redis.current
|
|
end
|
|
end
|