From 392808b950f68d8cfe0d577a68ae4acb048cdc4d Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 24 Feb 2022 11:52:39 +0100 Subject: [PATCH] Handle GapError in updates loop --- telethon/_client/updates.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/telethon/_client/updates.py b/telethon/_client/updates.py index 23d9ee27..5240e2f6 100644 --- a/telethon/_client/updates.py +++ b/telethon/_client/updates.py @@ -201,7 +201,11 @@ async def _update_loop(self: 'TelegramClient'): continue processed = [] - users, chats = self._message_box.process_updates(updates, self._entity_cache, processed) + try: + users, chats = self._message_box.process_updates(updates, self._entity_cache, processed) + except GapError: + continue # get(_channel)_difference will start returning requests + updates_to_dispatch.extend(_preprocess_updates(self, processed, users, chats)) except Exception: self._log[__name__].exception('Fatal error handling updates (this is a bug in Telethon, please report it)')