mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-02 19:20:09 +03:00
Fix SendMessage FloodWaits on TEST cloud
On the TEST cloud, flood waits do not always include the correct number of seconds. The server sends FLOOD_WAIT_0, so Telethon sleeps 0 seconds before retrying. This leads to a ValueError: Request was unsuccessful 6 times. By making a minimum flood wait duration of 1 second, this error is mitigated, as the delay is long enough to avoid the rapid retries, and the request succeeds on the 2nd attempt. For once, I tested this change, and it fixed the issue.
This commit is contained in:
parent
393da7e57a
commit
9ba93285f8
|
@ -92,6 +92,9 @@ class UserMethods:
|
|||
self._flood_waited_requests\
|
||||
[request.CONSTRUCTOR_ID] = time.time() + e.seconds
|
||||
|
||||
if e.seconds == 0:
|
||||
e.seconds = 1
|
||||
|
||||
if e.seconds <= self.flood_sleep_threshold:
|
||||
self._log[__name__].info(*_fmt_flood(e.seconds, request))
|
||||
await asyncio.sleep(e.seconds, loop=self._loop)
|
||||
|
|
Loading…
Reference in New Issue
Block a user