Skip to content

Commit

Permalink
add timeout to HTTP connections
Browse files Browse the repository at this point in the history
  • Loading branch information
Noordsestern committed Nov 18, 2022
1 parent 75244e3 commit 854aae3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Catow/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ def run_server():
async def watch_topic():
while True:
try:
response = requests.get(f'{CatowConfig().cmd_args.camundaurl}/engine-rest/external-task/count?topicName={CatowConfig().cmd_args.topic}&notlocked=true&active=true&withRetriesLeft=true')
response = requests.get(f'{CatowConfig().cmd_args.camundaurl}/engine-rest/external-task/count?topicName={CatowConfig().cmd_args.topic}&notlocked=true&active=true&withRetriesLeft=true', timeout=(3.05, 5))
response.raise_for_status()
#print(response.text)
response_body = json.loads(response.text)
count = response_body["count"]
if count > 0:
print(f"Start Robot for amount of process instances: {count}")
try:
response = requests.get(CatowConfig().cmd_args.roboturl)
response = requests.get(CatowConfig().cmd_args.roboturl, timeout=(3.05, 5))
response.raise_for_status()
except Exception as e:
print(f'[WARN] Failed to trigger robot:\n{e}')
Expand Down

0 comments on commit 854aae3

Please sign in to comment.