mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 02:03:04 +00:00
partial rollback. add TODO.
This commit is contained in:
parent
84145caf03
commit
e1eed6ccb7
1 changed files with 5 additions and 2 deletions
|
|
@ -11,6 +11,9 @@ __all__ = ['RethinkDBStorage', 'ConnectionNotClosed']
|
||||||
r.set_loop_type('asyncio')
|
r.set_loop_type('asyncio')
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: rewrite connections pool
|
||||||
|
|
||||||
|
|
||||||
class ConnectionNotClosed(Exception):
|
class ConnectionNotClosed(Exception):
|
||||||
"""
|
"""
|
||||||
Indicates that DB connection wasn't closed.
|
Indicates that DB connection wasn't closed.
|
||||||
|
|
@ -105,7 +108,7 @@ class RethinkDBStorage(BaseStorage):
|
||||||
"""
|
"""
|
||||||
Does nothing
|
Does nothing
|
||||||
"""
|
"""
|
||||||
await asyncio.sleep(0)
|
pass
|
||||||
|
|
||||||
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]:
|
||||||
|
|
@ -113,7 +116,7 @@ class RethinkDBStorage(BaseStorage):
|
||||||
conn = await self.get_connection()
|
conn = await self.get_connection()
|
||||||
result = await r.table(self._table).get(chat)[user]['state'].default(default or None).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
|
||||||
|
|
||||||
async def get_data(self, *, chat: typing.Union[str, int, None] = None, user: typing.Union[str, int, None] = None,
|
async def get_data(self, *, chat: typing.Union[str, int, None] = None, user: typing.Union[str, int, None] = None,
|
||||||
default: typing.Optional[str] = None) -> typing.Dict:
|
default: typing.Optional[str] = None) -> typing.Dict:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue