From 7807f5d5e0aa5d2beb025166c33e48576bc4f0b3 Mon Sep 17 00:00:00 2001 From: Jonathan Wu Date: Sun, 29 Oct 2023 00:47:58 -0400 Subject: [PATCH] Add timeout to instancer requests --- src/views/api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/api.py b/src/views/api.py index 42de6b9..68eae8b 100644 --- a/src/views/api.py +++ b/src/views/api.py @@ -88,7 +88,7 @@ def query_instancer(): try: response = requests.post(app.config["INSTANCER_HOST"] + "/api/v1/query", - headers=headers, json=body) + headers=headers, json=body, timeout=3) return json_success(response.json()) except Exception: return json_fail("Failed to get a valid response from the instance server", 500) @@ -134,7 +134,7 @@ def create_instancer(): try: response = requests.post(app.config["INSTANCER_HOST"] + "/api/v1/create", - headers=headers, json=body) + headers=headers, json=body, timeout=3) return json_success(response.json()) except Exception: return json_fail("Failed to get a valid response from the instance server", 500) @@ -179,7 +179,7 @@ def destroy_instancer(): try: response = requests.post(app.config["INSTANCER_HOST"] + "/api/v1/destroy", - headers=headers, json=body) + headers=headers, json=body, timeout=3) return json_success(response.json()) except Exception: return json_fail("Failed to get a valid response from the instance server", 500)