Skip to content

Commit

Permalink
Try removing retry on ReadError/ReadTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanFauble committed Sep 20, 2024
1 parent 4c7b2b9 commit 80bbd1e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
8 changes: 7 additions & 1 deletion synapseclient/api/entity_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from async_lru import alru_cache

from synapseclient.core.exceptions import SynapseHTTPError
from synapseclient.core.retry import RETRYABLE_CONNECTION_EXCEPTIONS_NO_READ_ISSUES

if TYPE_CHECKING:
from synapseclient import Synapse
Expand Down Expand Up @@ -42,7 +43,12 @@ async def post_entity(

try:
return await client.rest_post_async(
uri="/entity", body=json.dumps(request), params=params
uri="/entity",
body=json.dumps(request),
params=params,
retry_policy={
"retry_exceptions": RETRYABLE_CONNECTION_EXCEPTIONS_NO_READ_ISSUES
},
)
except SynapseHTTPError:
if "name" in request and "parentId" in request:
Expand Down
15 changes: 15 additions & 0 deletions synapseclient/core/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@
"SSLZeroReturnError",
]

RETRYABLE_CONNECTION_EXCEPTIONS_NO_READ_ISSUES = [
"ChunkedEncodingError",
"ConnectionError",
"ConnectionResetError",
"Timeout",
"timeout",
# HTTPX Specific connection exceptions:
"RemoteProtocolError",
"TimeoutException",
"ConnectError",
"ConnectTimeout",
# SSL Specific exceptions:
"SSLZeroReturnError",
]

DEBUG_EXCEPTION = "calling %s resulted in an Exception"


Expand Down

0 comments on commit 80bbd1e

Please sign in to comment.