From a4f684f6bf6a1166fc98552e4a134f400b0995fd Mon Sep 17 00:00:00 2001 From: Anton Patrushev Date: Wed, 28 Aug 2019 23:39:31 +0200 Subject: [PATCH] process cancellation in dispatch polling --- aiogram/dispatcher/dispatcher.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aiogram/dispatcher/dispatcher.py b/aiogram/dispatcher/dispatcher.py index 6d16a005..d8226f31 100644 --- a/aiogram/dispatcher/dispatcher.py +++ b/aiogram/dispatcher/dispatcher.py @@ -284,6 +284,8 @@ class Dispatcher(DataMixin, ContextInstanceMixin): try: with self.bot.request_timeout(request_timeout): updates = await self.bot.get_updates(limit=limit, offset=offset, timeout=timeout) + except asyncio.CancelledError: + break except: log.exception('Cause exception while getting updates.') await asyncio.sleep(error_sleep)