mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
ec34ec63b1
* Add spec files for feed and media cleanup workers * Add coverage for feed and media cleanup schedulers * Clean up feed and media cleanup workers
27 lines
478 B
Ruby
27 lines
478 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.inactive
|
|
end
|
|
|
|
def redis
|
|
Redis.current
|
|
end
|
|
end
|