5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/esse/async_indexing/actions/import_batch_id.rb', line 5
def self.call(index_class_name, repo_name, batch_id, options = {})
_index_class, repo_class = CoerceIndexRepository.call(index_class_name, repo_name)
queue = Esse::RedisStorage::Queue.for(repo: repo_class)
kwargs = Esse::HashUtils.deep_transform_keys(options, &:to_sym)
kwargs[:context] ||= {}
result = 0
ids_from_batch = []
queue.fetch(batch_id) do |ids|
ids_from_batch = ids
kwargs[:context][:id] = ids
result = repo_class.import(**kwargs)
end
[result, ids_from_batch]
end
|