From caa16b7126c63acc82d68932b6693a431042d986 Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com> Date: Mon, 23 Oct 2023 17:00:01 +0200 Subject: [PATCH] fix: prevent endless waiting for response, without creating resources multiple times (DEV-2860) (#586) --- src/dsp_tools/connection/connection_live.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/dsp_tools/connection/connection_live.py b/src/dsp_tools/connection/connection_live.py index 5d4fec48d..fcb6af38c 100644 --- a/src/dsp_tools/connection/connection_live.py +++ b/src/dsp_tools/connection/connection_live.py @@ -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 @@ -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