From 438aff35452bf1425f6591fd54d3419517df9eb3 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 21 Jul 2023 23:01:12 +0200 Subject: [PATCH] Handle FloodWaitError in update loop Likely temporary server issues, since getDifference should realistically not fail with flood waits. In any case, stopping early until the problem is resolved is the correct approach. --- telethon/client/updates.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/telethon/client/updates.py b/telethon/client/updates.py index 11431e83..450a9e16 100644 --- a/telethon/client/updates.py +++ b/telethon/client/updates.py @@ -306,7 +306,12 @@ class UpdateMethods: self._log[__name__].debug('Getting difference for account updates') try: diff = await self(get_diff) - except (errors.ServerError, errors.TimeoutError, ValueError) as e: + except ( + errors.ServerError, + errors.TimeoutError, + errors.FloodWaitError, + ValueError + ) as e: # Telegram is having issues self._log[__name__].info('Cannot get difference since Telegram is having issues: %s', type(e).__name__) self._message_box.end_difference() @@ -380,6 +385,7 @@ class UpdateMethods: errors.PersistentTimestampInvalidError, errors.ServerError, errors.TimeoutError, + errors.FloodWaitError, ValueError ) as e: # According to Telegram's docs: