mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-09 09:22:03 +00:00
Implemented RedisStorage.reset_all - for resetting all states in storage.
This commit is contained in:
parent
191d3023bb
commit
1ab9c09a5c
1 changed files with 15 additions and 0 deletions
|
|
@ -153,3 +153,18 @@ class RedisStorage(BaseStorage):
|
|||
result.append((chat, user))
|
||||
|
||||
return result
|
||||
|
||||
async def reset_all(self, full=True):
|
||||
"""
|
||||
Reset states in DB
|
||||
|
||||
:param full: clean DB or clean only states
|
||||
:return:
|
||||
"""
|
||||
conn = await self.redis
|
||||
|
||||
if full:
|
||||
conn.execute('FLUSHDB')
|
||||
else:
|
||||
keys = await conn.execute('KEYS', 'fsm:*')
|
||||
conn.execute('DEL', *keys)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue