From a6781c8e34fa8f535a4afdcd5eff5d1348989460 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 7 Nov 2020 12:09:00 +0100 Subject: [PATCH] Don't cache SLOW_MODE_WAIT in _flood_waited_requests Closes #1600. --- telethon/client/users.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/telethon/client/users.py b/telethon/client/users.py index b2243a2e..ddd41433 100644 --- a/telethon/client/users.py +++ b/telethon/client/users.py @@ -94,8 +94,10 @@ class UserMethods: if utils.is_list_like(request): request = request[request_index] - self._flood_waited_requests\ - [request.CONSTRUCTOR_ID] = time.time() + e.seconds + # SLOW_MODE_WAIT is chat-specific, not request-specific + if not isinstance(e, errors.SlowModeWaitError): + self._flood_waited_requests\ + [request.CONSTRUCTOR_ID] = time.time() + e.seconds # In test servers, FLOOD_WAIT_0 has been observed, and sleeping for # such a short amount will cause retries very fast leading to issues.