Fix llm cache save problem in json_kv storage

This commit is contained in:
yangdx
2025-03-09 23:33:03 +08:00
parent bc42afe7b6
commit c938989920
3 changed files with 5 additions and 7 deletions

View File

@@ -98,11 +98,9 @@ class JsonKVStorage(BaseKVStorage):
async def upsert(self, data: dict[str, dict[str, Any]]) -> None:
if not data:
return
logger.info(f"Inserting {len(data)} to {self.namespace}")
async with self._storage_lock:
left_data = {k: v for k, v in data.items() if k not in self._data}
if left_data:
logger.info(f"Process {os.getpid()} KV inserting {len(left_data)} to {self.namespace}")
self._data.update(left_data)
self._data.update(data)
async def delete(self, ids: list[str]) -> None:
async with self._storage_lock: