From 2f5415c1c94e13d969ba164fb69b612d65ddba19 Mon Sep 17 00:00:00 2001 From: Gabben <43146729+gabbhack@users.noreply.github.com> Date: Thu, 10 Oct 2019 19:20:49 +0500 Subject: [PATCH] Fix incorrect completion order. --- aiogram/utils/executor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aiogram/utils/executor.py b/aiogram/utils/executor.py index 33f80684..fe3483f6 100644 --- a/aiogram/utils/executor.py +++ b/aiogram/utils/executor.py @@ -361,11 +361,11 @@ class Executor: await callback(self.dispatcher) async def _shutdown_polling(self, wait_closed=False): - await self._shutdown() - for callback in self._on_shutdown_polling: await callback(self.dispatcher) + await self._shutdown() + if wait_closed: await self.dispatcher.wait_closed()