5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/esse/async_indexing/actions/bulk_update_lazy_document_attribute.rb', line 5
def self.call(index_class_name, repo_name, attr_name, batch_id, options = {})
_index_class, repo_class = CoerceIndexRepository.call(index_class_name, repo_name)
queue = Esse::RedisStorage::Queue.for(repo: repo_class, attribute_name: attr_name)
kwargs = Esse::HashUtils.deep_transform_keys(options, &:to_sym)
attr_name = repo_class.lazy_document_attributes.keys.find { |key| key.to_s == attr_name.to_s }
updated_ids = []
queue.fetch(batch_id) do |ids|
updated_ids = ids
repo_class.update_documents_attribute(attr_name, ids, **kwargs)
end
updated_ids
end
|