pyrofork/pyrogram/session
fr0stb1rd 5112e5da36
Fix: Respect sleep_threshold=0 in invoke() to prevent unwanted FloodWait sleep
This PR updates the `invoke()` method to correctly handle `sleep_threshold=0`.

### Before:
Even when `sleep_threshold=0`, the client still waits for the full FloodWait duration.

### After:
With this change:
- If `sleep_threshold == 0`, it raises the FloodWait immediately (no sleep).
- If `sleep_threshold < 0`, it always raises (never sleeps).
- If `sleep_threshold > 0`, it only sleeps if `amount <= sleep_threshold`.

This makes `sleep_threshold` behave more as expected and allows advanced bot handling logic outside of Pyrogram.

Thanks!
2025-07-11 16:01:24 +03:00
..
internals pyrofork: Cleanup codes 2025-03-29 00:25:16 +07:00
__init__.py pyrofork: Cleanup codes 2025-03-29 00:25:16 +07:00
auth.py Implement non-blocking TCP connection (KurimuzonAkuma/pyrogram#71) 2024-06-23 16:59:32 +07:00
session.py Fix: Respect sleep_threshold=0 in invoke() to prevent unwanted FloodWait sleep 2025-07-11 16:01:24 +03:00