Skip to content

Commit

Permalink
Merge pull request #843 from parea-ai/fix-retry-on-read-error
Browse files Browse the repository at this point in the history
fix: retry on RemoteProtocolError
  • Loading branch information
joschkabraun committed May 3, 2024
2 parents 88f0902 + 788a47b commit aa8dbfb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion parea/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _should_retry(error, current_retry):
"""Determines if the function should retry on error."""
is_502_error = isinstance(error, httpx.HTTPStatusError) and error.response.status_code == 502
is_last_retry = current_retry == MAX_RETRIES - 1
return not is_last_retry and (isinstance(error, (httpx.ConnectError, httpx.ReadError)) or is_502_error)
return not is_last_retry and (isinstance(error, (httpx.ConnectError, httpx.ReadError, httpx.RemoteProtocolError)) or is_502_error)

if asyncio.iscoroutinefunction(func):
return async_wrapper
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "parea-ai"
packages = [{ include = "parea" }]
version = "0.2.148"
version = "0.2.149"
description = "Parea python sdk"
readme = "README.md"
authors = ["joel-parea-ai <[email protected]>"]
Expand Down

0 comments on commit aa8dbfb

Please sign in to comment.