Skip to content

Commit d1ed8c3

Browse files
committed
fix(async): await async_add_index_struct in adelete_nodes and adelete_ref_doc
Both async methods were calling the synchronous `add_index_struct` instead of `async_add_index_struct`, creating inconsistent async/sync usage within async methods. This can cause race conditions in async contexts where the event loop expects non-blocking operations.
1 parent b70bc85 commit d1ed8c3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • llama-index-core/llama_index/core/indices/vector_store

llama-index-core/llama_index/core/indices/vector_store/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ async def adelete_nodes(
380380
for node_id in node_ids:
381381
self._index_struct.delete(node_id)
382382
await self._docstore.adelete_document(node_id, raise_error=False)
383-
self._storage_context.index_store.add_index_struct(self._index_struct)
383+
await self._storage_context.index_store.async_add_index_struct(self._index_struct)
384384

385385
def delete_nodes(
386386
self,
@@ -456,7 +456,7 @@ async def adelete_ref_doc(
456456

457457
await asyncio.gather(*tasks)
458458

459-
self._storage_context.index_store.add_index_struct(self._index_struct)
459+
await self._storage_context.index_store.async_add_index_struct(self._index_struct)
460460

461461
@property
462462
def ref_doc_info(self) -> Dict[str, RefDocInfo]:

0 commit comments

Comments
 (0)