This commit is contained in:
Erik Johnston 2017-01-31 13:46:38 +00:00
parent ae7a132f38
commit 85c590105f
1 changed files with 4 additions and 0 deletions

View File

@ -125,6 +125,10 @@ class RetryDestinationLimiter(object):
def __exit__(self, exc_type, exc_val, exc_tb): def __exit__(self, exc_type, exc_val, exc_tb):
valid_err_code = False valid_err_code = False
if exc_type is not None and issubclass(exc_type, CodeMessageException): if exc_type is not None and issubclass(exc_type, CodeMessageException):
# Some error codes are perfectly fine for some APIs, whereas other
# APIs may expect to never received e.g. a 404. It's important to
# handle 404 as some remote servers will return a 404 when the HS
# has been decommissioned.
if exc_val.code < 400: if exc_val.code < 400:
valid_err_code = True valid_err_code = True
elif exc_val.code == 404 and self.backoff_on_404: elif exc_val.code == 404 and self.backoff_on_404: