otwarchive-symphonyarchive/app/jobs/async_indexer_job.rb
2026-03-11 22:22:11 +00:00

15 lines
381 B
Ruby

# A job to index the record IDs queued up by AsyncIndexer.
class AsyncIndexerJob < ApplicationJob
REDIS = AsyncIndexer::REDIS
def perform(name)
indexer = name.split(":").first.constantize
ids = REDIS.smembers(name)
return if ids.empty?
batch = indexer.new(ids).index_documents
IndexSweeper.new(batch, indexer).process_batch
REDIS.del(name)
end
end