mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
avoid unclosed connections if get exception in emit_shutdown
This commit is contained in:
parent
8b9972f1ed
commit
b2e76b307f
1 changed files with 5 additions and 3 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue