Skip to content

Commit

Permalink
Add timeout to instancer requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jdabtieu committed Oct 29, 2023
1 parent e0533d4 commit 7807f5d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7807f5d

Please sign in to comment.