mirror of
https://github.com/whippyshou/mastodon
synced 2024-12-16 07:38:19 +09:00
d0c9ac3919
Fix #19646
29 lines
548 B
Ruby
29 lines
548 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Scheduler::IndexingScheduler
|
|
include Sidekiq::Worker
|
|
include Redisable
|
|
|
|
sidekiq_options retry: 0
|
|
|
|
def perform
|
|
return unless Chewy.enabled?
|
|
|
|
indexes.each do |type|
|
|
with_redis do |redis|
|
|
ids = redis.smembers("chewy:queue:#{type.name}")
|
|
|
|
type.import!(ids)
|
|
|
|
redis.pipelined do |pipeline|
|
|
ids.each { |id| pipeline.srem("chewy:queue:#{type.name}", id) }
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
def indexes
|
|
[AccountsIndex, TagsIndex, StatusesIndex]
|
|
end
|
|
end
|