Browse Source

Re-try requests on 504 error and raise correct error

pull/7192/head
Lilly Rose Berner 4 years ago
committed by GitHub
parent
commit
0aa825557d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      discord/http.py

6
discord/http.py

@ -321,8 +321,8 @@ class HTTPClient:
continue
# we've received a 500 or 502, unconditional retry
if response.status in {500, 502}:
# we've received a 500, 502, or 504, unconditional retry
if response.status in {500, 502, 504}:
await asyncio.sleep(1 + tries * 2)
continue
@ -331,7 +331,7 @@ class HTTPClient:
raise Forbidden(response, data)
elif response.status == 404:
raise NotFound(response, data)
elif response.status == 503:
elif response.status >= 500:
raise DiscordServerError(response, data)
else:
raise HTTPException(response, data)

Loading…
Cancel
Save