From 8b9972f1ed8a0da7e482a16e3c447623a49e2927 Mon Sep 17 00:00:00 2001 From: darksidecat <58224121+darksidecat@users.noreply.github.com> Date: Mon, 18 Oct 2021 00:27:01 +0300 Subject: [PATCH] Close bots sessions after emit_shutdown --- aiogram/dispatcher/dispatcher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aiogram/dispatcher/dispatcher.py b/aiogram/dispatcher/dispatcher.py index fa848547..f2beeac6 100644 --- a/aiogram/dispatcher/dispatcher.py +++ b/aiogram/dispatcher/dispatcher.py @@ -393,10 +393,10 @@ class Dispatcher(Router): ) await asyncio.gather(*coro_list) finally: - for bot in bots: # Close sessions - await bot.session.close() loggers.dispatcher.info("Polling stopped") await self.emit_shutdown(**workflow_data) + for bot in bots: # Close sessions + await bot.session.close() def run_polling( self,