Mastodon/app/workers/scheduler/indexing_scheduler.rb.orig

37 lines
909 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|
<<<<<<< HEAD
ids = redis.smembers("chewy:queue:#{type.name}")
type.import!(ids)
redis.pipelined do |pipeline|
ids.each { |id| pipeline.srem("chewy:queue:#{type.name}", id) }
=======
redis.sscan_each("chewy:queue:#{type.name}", count: SCAN_BATCH_SIZE).each_slice(IMPORT_BATCH_SIZE) do |ids|
type.import!(ids)
redis.pipelined do |pipeline|
pipeline.srem("chewy:queue:#{type.name}", ids)
end
>>>>>>> 652ff7646 (Fix Redis client and type errors introduced in #24285 (#24342))
end
end
end
end
def indexes
[AccountsIndex, TagsIndex, StatusesIndex]
end
end