From 50aa92ebdecf5422205af98dfd2728f249ee42be Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Wed, 14 Sep 2022 17:11:13 +0200 Subject: [PATCH] Handle CancelledError inside update loop This error is not really unexpected, since the library uses it to cancel the task during disconnect. Closes #3921. --- telethon/client/updates.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/telethon/client/updates.py b/telethon/client/updates.py index 17b93db1..735f45aa 100644 --- a/telethon/client/updates.py +++ b/telethon/client/updates.py @@ -351,6 +351,8 @@ class UpdateMethods: continue # get(_channel)_difference will start returning requests updates_to_dispatch.extend(self._preprocess_updates(processed, users, chats)) + except asyncio.CancelledError: + pass except Exception: self._log[__name__].exception('Fatal error handling updates (this is a bug in Telethon, please report it)')