Don't make a request at all if it will trigger flood wait

This commit is contained in:
Lonami Exo
2018-07-21 12:25:20 +02:00
parent a9cc35e604
commit 24758b82ec
3 changed files with 27 additions and 0 deletions

View File

@@ -226,6 +226,9 @@ class TelegramBaseClient(abc.ABC):
auto_reconnect_callback=self._handle_auto_reconnect
)
# Remember flood-waited requests to avoid making them again
self._flood_waited_requests = {}
# Cache ``{dc_id: (n, MTProtoSender)}`` for all borrowed senders,
# being ``n`` the amount of borrows a given sender has; once ``n``
# reaches ``0`` it should be disconnected and removed.