Add ChunkedEncodingError, ContentDecodingError and StreamConsumedError to retry list

This commit is contained in:
allegroai 2023-11-17 09:25:15 +02:00
parent 27021a1a19
commit 0af630e9cf

View File

@ -12,6 +12,7 @@ import jwt
import requests import requests
import six import six
from requests.auth import HTTPBasicAuth from requests.auth import HTTPBasicAuth
from requests.exceptions import ChunkedEncodingError, ContentDecodingError, StreamConsumedError
from six.moves.urllib.parse import urlparse, urlunparse from six.moves.urllib.parse import urlparse, urlunparse
from typing import List, Optional from typing import List, Optional
@ -418,6 +419,13 @@ class Session(TokenManager):
(self._logger or get_logger()).warning("SSLError Retrying {}".format(ex)) (self._logger or get_logger()).warning("SSLError Retrying {}".format(ex))
sleep(0.1) sleep(0.1)
continue continue
except (ChunkedEncodingError, ContentDecodingError, StreamConsumedError) as ex:
retry_counter += 1
# we should retry
if retry_counter >= self._ssl_error_count_verbosity:
(self._logger or get_logger()).warning("Network decoding error Retrying {}".format(ex))
sleep(0.1)
continue
if ( if (
refresh_token_if_unauthorized refresh_token_if_unauthorized