From 06b0ae56d4afa7db2ff570f7124a8977a30f5f4f Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Mon, 23 May 2022 13:56:10 +0200 Subject: [PATCH] Treat invalid pts as outdated pts --- telethon/client/updates.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/telethon/client/updates.py b/telethon/client/updates.py index 6d516c39..a789e77c 100644 --- a/telethon/client/updates.py +++ b/telethon/client/updates.py @@ -296,6 +296,20 @@ class UpdateMethods: self._mb_entity_cache ) continue + except errors.PersistentTimestampInvalidError: + # Somehow our pts is either too new or the server does not know about this. + # We treat this as PersistentTimestampOutdatedError for now. + # TODO investigate why/when this happens and if this is the proper solution + self._log[__name__].warning( + 'Getting difference for channel updates caused PersistentTimestampInvalidError;' + ' ending getting difference prematurely until server issues are resolved' + ) + self._message_box.end_channel_difference( + get_diff, + PrematureEndReason.TEMPORARY_SERVER_ISSUES, + self._mb_entity_cache + ) + continue except errors.ChannelPrivateError: # Timeout triggered a get difference, but we have been banned in the channel since then. # Because we can no longer fetch updates from this channel, we should stop keeping track