Daniel.y commited on
Commit
ba1d878
·
unverified ·
2 Parent(s): 75373e5 9006b6b

Merge pull request #1465 from danielaskdd/main

Browse files

Hot Fix: solved dead lock problem for FAISS vector storage

Files changed (1) hide show
  1. lightrag/kg/faiss_impl.py +5 -6
lightrag/kg/faiss_impl.py CHANGED
@@ -85,7 +85,7 @@ class FaissVectorDBStorage(BaseVectorStorage):
85
  self._id_to_meta = {}
86
  self._load_faiss_index()
87
  self.storage_updated.value = False
88
- return self._index
89
 
90
  async def upsert(self, data: dict[str, dict[str, Any]]) -> None:
91
  """
@@ -362,11 +362,10 @@ class FaissVectorDBStorage(BaseVectorStorage):
362
  logger.warning(
363
  f"Storage for FAISS {self.namespace} was updated by another process, reloading..."
364
  )
365
- async with self._storage_lock:
366
- self._index = faiss.IndexFlatIP(self._dim)
367
- self._id_to_meta = {}
368
- self._load_faiss_index()
369
- self.storage_updated.value = False
370
  return False # Return error
371
 
372
  # Acquire lock and perform persistence
 
85
  self._id_to_meta = {}
86
  self._load_faiss_index()
87
  self.storage_updated.value = False
88
+ return self._index
89
 
90
  async def upsert(self, data: dict[str, dict[str, Any]]) -> None:
91
  """
 
362
  logger.warning(
363
  f"Storage for FAISS {self.namespace} was updated by another process, reloading..."
364
  )
365
+ self._index = faiss.IndexFlatIP(self._dim)
366
+ self._id_to_meta = {}
367
+ self._load_faiss_index()
368
+ self.storage_updated.value = False
 
369
  return False # Return error
370
 
371
  # Acquire lock and perform persistence