mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
Fixed RethinkDBStorage.
This commit is contained in:
parent
272322ab38
commit
5ed2b35eed
2 changed files with 4 additions and 3 deletions
|
|
@ -101,7 +101,7 @@ class RethinkDBStorage(BaseStorage):
|
||||||
except r.ReqlError:
|
except r.ReqlError:
|
||||||
raise ConnectionNotClosed('Exception was caught while closing connection')
|
raise ConnectionNotClosed('Exception was caught while closing connection')
|
||||||
|
|
||||||
def wait_closed(self):
|
async def wait_closed(self):
|
||||||
"""
|
"""
|
||||||
Checks if connection is closed.
|
Checks if connection is closed.
|
||||||
"""
|
"""
|
||||||
|
|
@ -115,7 +115,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 '').run(conn)
|
result = await r.table(self._table).get(chat)[user]['state'].default(default or '').run(conn)
|
||||||
await self.put_connection(conn)
|
await self.put_connection(conn)
|
||||||
return result
|
return result or None
|
||||||
|
|
||||||
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:
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,8 @@ class Executor:
|
||||||
loop.create_task(self.dispatcher.start_polling(reset_webhook=reset_webhook))
|
loop.create_task(self.dispatcher.start_polling(reset_webhook=reset_webhook))
|
||||||
loop.run_forever()
|
loop.run_forever()
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
loop.stop()
|
# loop.stop()
|
||||||
|
pass
|
||||||
finally:
|
finally:
|
||||||
loop.run_until_complete(self._shutdown_polling())
|
loop.run_until_complete(self._shutdown_polling())
|
||||||
log.warning("Goodbye!")
|
log.warning("Goodbye!")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue