Persistence cache data to disk before exiting

This commit is contained in:
yangdx
2025-04-28 23:16:50 +08:00
parent 0ecae90002
commit 40a2357c14

View File

@@ -197,3 +197,10 @@ class JsonKVStorage(BaseKVStorage):
except Exception as e:
logger.error(f"Error dropping {self.namespace}: {e}")
return {"status": "error", "message": str(e)}
async def finalize(self):
"""Finalize storage resources
Persistence cache data to disk before exiting
"""
if self.namespace.endswith("cache"):
await self.index_done_callback()