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.
This commit is contained in:
Lonami Exo 2023-07-21 23:01:12 +02:00
parent 4eef9b52c9
commit 438aff3545

View File

@ -306,7 +306,12 @@ class UpdateMethods:
self._log[__name__].debug('Getting difference for account updates') self._log[__name__].debug('Getting difference for account updates')
try: try:
diff = await self(get_diff) 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 # Telegram is having issues
self._log[__name__].info('Cannot get difference since Telegram is having issues: %s', type(e).__name__) self._log[__name__].info('Cannot get difference since Telegram is having issues: %s', type(e).__name__)
self._message_box.end_difference() self._message_box.end_difference()
@ -380,6 +385,7 @@ class UpdateMethods:
errors.PersistentTimestampInvalidError, errors.PersistentTimestampInvalidError,
errors.ServerError, errors.ServerError,
errors.TimeoutError, errors.TimeoutError,
errors.FloodWaitError,
ValueError ValueError
) as e: ) as e:
# According to Telegram's docs: # According to Telegram's docs: