Fixed RethinkDBStorage.

This commit is contained in:
Alex Root Junior 2018-05-18 21:13:19 +03:00
parent 272322ab38
commit 5ed2b35eed
2 changed files with 4 additions and 3 deletions

View file

@ -101,7 +101,7 @@ class RethinkDBStorage(BaseStorage):
except r.ReqlError:
raise ConnectionNotClosed('Exception was caught while closing connection')
def wait_closed(self):
async def wait_closed(self):
"""
Checks if connection is closed.
"""
@ -115,7 +115,7 @@ class RethinkDBStorage(BaseStorage):
conn = await self.get_connection()
result = await r.table(self._table).get(chat)[user]['state'].default(default or '').run(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,
default: typing.Optional[str] = None) -> typing.Dict:

View file

@ -232,7 +232,8 @@ class Executor:
loop.create_task(self.dispatcher.start_polling(reset_webhook=reset_webhook))
loop.run_forever()
except (KeyboardInterrupt, SystemExit):
loop.stop()
# loop.stop()
pass
finally:
loop.run_until_complete(self._shutdown_polling())
log.warning("Goodbye!")