Merge pull request #831 from YanSte/drops

fallback default drops
This commit is contained in:
Yannick Stephan
2025-02-18 08:46:42 +01:00
committed by GitHub
3 changed files with 16 additions and 0 deletions

View File

@@ -50,3 +50,6 @@ class JsonKVStorage(BaseKVStorage):
for doc_id in ids:
self._data.pop(doc_id, None)
await self.index_done_callback()
async def drop(self) -> None:
self._data = {}

View File

@@ -117,6 +117,10 @@ class MongoKVStorage(BaseKVStorage):
# Mongo handles persistence automatically
pass
async def drop(self) -> None:
"""Drop the collection"""
await self._data.drop()
@final
@dataclass
@@ -198,6 +202,10 @@ class MongoDocStatusStorage(DocStatusStorage):
# Mongo handles persistence automatically
pass
async def drop(self) -> None:
"""Drop the collection"""
await self._data.drop()
@final
@dataclass

View File

@@ -61,3 +61,8 @@ class RedisKVStorage(BaseKVStorage):
async def index_done_callback(self) -> None:
# Redis handles persistence automatically
pass
async def drop(self) -> None:
keys = await self._redis.keys(f"{self.namespace}:*")
if keys:
await self._redis.delete(*keys)