Skip to content

Commit

Permalink
Add "Server disconnected without sending a response" error to a backoff
Browse files Browse the repository at this point in the history
  • Loading branch information
pehala committed Mar 6, 2024
1 parent 091c9bb commit 3ad872a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion testsuite/httpx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ def __init__(self, retry_codes, response=None, error=None):

def should_backoff(self):
"""True, if the Result can be considered an instability and should be retried"""
return self.has_dns_error() or (self.error is None and self.status_code in self.retry_codes)
return (
self.has_dns_error()
or (self.error is None and self.status_code in self.retry_codes)
or self.has_error("Server disconnected without sending a response.")
)

def has_error(self, error_msg: str) -> bool:
"""True, if the request failed and an error with message was returned"""
Expand Down

0 comments on commit 3ad872a

Please sign in to comment.