Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent endless waiting for response, without creating resources multiple times (DEV-2860) #586

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/dsp_tools/connection/connection_live.py
Original file line number Diff line number Diff line change
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