Skip to content

Commit

Permalink
Merge pull request #49 from ImageMarkup/add-retry-type
Browse files Browse the repository at this point in the history
Add retries to ChunkedEncodingError
  • Loading branch information
danlamanna authored Jun 6, 2023
2 parents cbc9ab8 + 1bcef25 commit bf932d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions isic_cli/io/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Optional, Union

from more_itertools import chunked
from requests.exceptions import ConnectionError
from requests.exceptions import ChunkedEncodingError, ConnectionError
from tenacity import (
before_sleep_log,
retry,
Expand Down Expand Up @@ -111,7 +111,7 @@ def get_num_images(session: IsicCliSession, search: str = "", collections: str =
# see https://github.com/danlamanna/retryable-requests/issues/10 to understand the
# scenario which requires additional retry logic.
@retry(
retry=retry_if_exception_type(ConnectionError),
retry=retry_if_exception_type((ConnectionError, ChunkedEncodingError)),
wait=wait_exponential(multiplier=1, min=3, max=10),
stop=stop_after_attempt(5),
before_sleep=before_sleep_log(logger, logging.DEBUG),
Expand Down

0 comments on commit bf932d4

Please sign in to comment.