From 8bf29dec149e3c4ca325977559ca598c490b4122 Mon Sep 17 00:00:00 2001 From: imp <106537315+imptype@users.noreply.github.com> Date: Mon, 1 Sep 2025 01:36:56 +0100 Subject: [PATCH] Revert OSError logic --- discord/http.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/discord/http.py b/discord/http.py index 74dea612b..cedb4fdb6 100644 --- a/discord/http.py +++ b/discord/http.py @@ -737,12 +737,11 @@ class HTTPClient: # This is handling exceptions from the request except OSError as e: - if tries == 4 or e.errno not in (54, 10054): - raise ValueError('Connection reset by peer') - retry_seconds: int = 1 + tries * 2 - fmt = 'OS error for %s %s. Retrying in %d seconds.' - _log.warning(fmt, method, url, retry_seconds) - await asyncio.sleep(retry_seconds) + # Connection reset by peer + if tries < 4 and e.errno in (54, 10054): + await asyncio.sleep(1 + tries * 2) + continue + raise # We've run out of retries, raise if response is not None: