Skip to content

Commit

Permalink
fix: prevent endless waiting for response, without creating resources…
Browse files Browse the repository at this point in the history
… multiple times (DEV-2860) (#586)
  • Loading branch information
jnussbaum committed Oct 23, 2023
1 parent b0d1978 commit caa16b7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/dsp_tools/connection/connection_live.py
Expand Up @@ -158,10 +158,11 @@ def post(
Returns:
response from server
"""
# timeout must be None,
# timeout must be high enough,
# otherwise the client can get a timeout error while the API is still processing the request
# in that case, the client's retry will fail, and the response of the original API call is lost
timeout = None
# in that case, the client's retry will have undesired side effects (e.g. duplicated resources),
# and the response of the original API call will be lost
timeout = 60
if not route.startswith("/"):
route = "/" + route
url = self.server + route
Expand Down Expand Up @@ -248,10 +249,10 @@ def put(
Returns:
response from server
"""
# timeout must be None,
# timeout must be high enough,
# otherwise the client can get a timeout error while the API is still processing the request
# in that case, the client's retry will fail, and the response of the original API call is lost
timeout = None
# in that case, the client's retry will fail, and the response of the original API call will be lost
timeout = 60
if not route.startswith("/"):
route = "/" + route
url = self.server + route
Expand Down

0 comments on commit caa16b7

Please sign in to comment.