diff --git a/aiogram/dispatcher/dispatcher.py b/aiogram/dispatcher/dispatcher.py index f2beeac6..2c78bace 100644 --- a/aiogram/dispatcher/dispatcher.py +++ b/aiogram/dispatcher/dispatcher.py @@ -394,9 +394,11 @@ class Dispatcher(Router): await asyncio.gather(*coro_list) finally: loggers.dispatcher.info("Polling stopped") - await self.emit_shutdown(**workflow_data) - for bot in bots: # Close sessions - await bot.session.close() + try: + await self.emit_shutdown(**workflow_data) + finally: + for bot in bots: # Close sessions + await bot.session.close() def run_polling( self,