Merge pull request #1465 from danielaskdd/main
Browse filesHot Fix: solved dead lock problem for FAISS vector storage
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 |
-
|
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 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
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
|