diff --git a/aiogram/contrib/fsm_storage/rethinkdb.py b/aiogram/contrib/fsm_storage/rethinkdb.py index 8c6d24ae..9aeef13f 100644 --- a/aiogram/contrib/fsm_storage/rethinkdb.py +++ b/aiogram/contrib/fsm_storage/rethinkdb.py @@ -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: diff --git a/aiogram/utils/executor.py b/aiogram/utils/executor.py index dc5b60ad..39e10333 100644 --- a/aiogram/utils/executor.py +++ b/aiogram/utils/executor.py @@ -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!")