Don't send pings unless the connection is made

This will hopefully avoid batching tens of ping requests which
we don't care about their results.
This commit is contained in:
Lonami Exo
2019-12-02 18:32:31 +01:00
parent 149b26fb51
commit cd37478e31
2 changed files with 13 additions and 0 deletions

View File

@@ -335,6 +335,12 @@ class UpdateMethods:
except Exception:
continue # Any disconnected exception should be ignored
# Don't bother sending pings until the low-level connection is
# ready, otherwise a lot of pings will be batched to be sent upon
# reconnect, when we really don't care about that.
if not self._sender._transport_connected():
continue
# We also don't really care about their result.
# Just send them periodically.
try: