6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/esse/async_indexing/jobs/import_batch_id_job.rb', line 6
def perform(index_class_name, repo_name, batch_id, options = {})
total, ids = Esse::AsyncIndexing::Actions::ImportBatchId.call(index_class_name, repo_name, batch_id, options)
options = Esse::HashUtils.deep_transform_keys(options, &:to_s)
return total if total.zero?
return total if lazy_already_imported?(options)
return total unless self.class.respond_to?(:bg_worker_options)
_index_class, repo_class = Esse::AsyncIndexing::Actions::CoerceIndexRepository.call(index_class_name, repo_name)
repo_class.lazy_document_attributes.each_key do |attr_name|
queue = Esse::RedisStorage::Queue.for(repo: repo_class, attribute_name: attr_name)
queue.enqueue(id: batch_id, values: ids)
Esse::AsyncIndexing.worker(LAZY_ATTR_WORKER, service: self.class.bg_worker_options[:service])
.with_args(index_class_name, repo_name, attr_name.to_s, batch_id, options)
.push
end
total
end
|