mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 01:54:53 +00:00
commit
84145caf03
1 changed files with 3 additions and 5 deletions
|
|
@ -103,17 +103,15 @@ class RethinkDBStorage(BaseStorage):
|
||||||
|
|
||||||
async def wait_closed(self):
|
async def wait_closed(self):
|
||||||
"""
|
"""
|
||||||
Checks if connection is closed.
|
Does nothing
|
||||||
"""
|
"""
|
||||||
if len(self._outstanding_connections) != 0 and self._queue.qsize() != 0:
|
await asyncio.sleep(0)
|
||||||
raise ConnectionNotClosed
|
|
||||||
return True
|
|
||||||
|
|
||||||
async def get_state(self, *, chat: typing.Union[str, int, None] = None, user: typing.Union[str, int, None] = None,
|
async def get_state(self, *, chat: typing.Union[str, int, None] = None, user: typing.Union[str, int, None] = None,
|
||||||
default: typing.Optional[str] = None) -> typing.Optional[str]:
|
default: typing.Optional[str] = None) -> typing.Optional[str]:
|
||||||
chat, user = map(str, self.check_address(chat=chat, user=user))
|
chat, user = map(str, self.check_address(chat=chat, user=user))
|
||||||
conn = await self.get_connection()
|
conn = await self.get_connection()
|
||||||
result = await r.table(self._table).get(chat)[user]['state'].default(default or '').run(conn)
|
result = await r.table(self._table).get(chat)[user]['state'].default(default or None).run(conn)
|
||||||
await self.put_connection(conn)
|
await self.put_connection(conn)
|
||||||
return result or None
|
return result or None
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue