Browse Source

Revert OSError logic

pull/10287/head
imp 2 months ago
committed by GitHub
parent
commit
8bf29dec14
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 11
      discord/http.py

11
discord/http.py

@ -737,12 +737,11 @@ class HTTPClient:
# This is handling exceptions from the request # This is handling exceptions from the request
except OSError as e: except OSError as e:
if tries == 4 or e.errno not in (54, 10054): # Connection reset by peer
raise ValueError('Connection reset by peer') if tries < 4 and e.errno in (54, 10054):
retry_seconds: int = 1 + tries * 2 await asyncio.sleep(1 + tries * 2)
fmt = 'OS error for %s %s. Retrying in %d seconds.' continue
_log.warning(fmt, method, url, retry_seconds) raise
await asyncio.sleep(retry_seconds)
# We've run out of retries, raise # We've run out of retries, raise
if response is not None: if response is not None:

Loading…
Cancel
Save