yangdx commited on
Commit
6bff8df
·
1 Parent(s): c36623a

Persistence cache data to disk before exiting

Browse files
Files changed (1) hide show
  1. lightrag/kg/json_kv_impl.py +7 -0
lightrag/kg/json_kv_impl.py CHANGED
@@ -197,3 +197,10 @@ class JsonKVStorage(BaseKVStorage):
197
  except Exception as e:
198
  logger.error(f"Error dropping {self.namespace}: {e}")
199
  return {"status": "error", "message": str(e)}
 
 
 
 
 
 
 
 
197
  except Exception as e:
198
  logger.error(f"Error dropping {self.namespace}: {e}")
199
  return {"status": "error", "message": str(e)}
200
+
201
+ async def finalize(self):
202
+ """Finalize storage resources
203
+ Persistence cache data to disk before exiting
204
+ """
205
+ if self.namespace.endswith("cache"):
206
+ await self.index_done_callback()