Skip to content

Commit

Permalink
Add 10s timeout for all HTTP requests
Browse files Browse the repository at this point in the history
  • Loading branch information
luk1337 committed May 27, 2023
1 parent 9b32f94 commit d793acf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bot/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def post_reply(iid, reply):
f"https://gitlab.com/api/v4/projects/{project}/issues/{iid}/notes",
json={"body": "\n".join(reply)},
headers=headers,
timeout=10,
)
if resp.status_code != 201:
print(f"Error replying - ${resp.json()}")
Expand All @@ -109,6 +110,7 @@ def edit_issue(iid, edits):
f"https://gitlab.com/api/v4/projects/{project}/issues/{iid}",
json=edits,
headers=headers,
timeout=10,
)
if resp.status_code != 200:
print(f"Error updating labels - ${resp.json()}")
Expand All @@ -123,6 +125,7 @@ def process_new():
resp = requests.get(
f"https://gitlab.com/api/v4/projects/{project}/issues?state=opened&labels=None",
headers=headers,
timeout=10,
)
if resp.status_code != 200:
print(f"Error updating labels - ${resp.json()}")
Expand Down Expand Up @@ -166,6 +169,7 @@ def process_invalid():
resp = requests.get(
f"https://gitlab.com/api/v4/projects/{project}/issues?state=opened&labels=invalid",
headers=headers,
timeout=10,
)
if resp.status_code != 200:
print(f"Error getting invalid issues - {resp.json()}")
Expand Down Expand Up @@ -203,7 +207,8 @@ def load_valid_options():
global options
try:
r = requests.get(
"https://raw.githubusercontent.com/LineageOS/hudson/master/lineage-build-targets"
"https://raw.githubusercontent.com/LineageOS/hudson/master/lineage-build-targets",
timeout=10,
)
except requests.exceptions.RequestException as e:
print(e)
Expand Down

0 comments on commit d793acf

Please sign in to comment.