From 854aae39f5361ae1ca1db8facad8d13fe5c7e8bb Mon Sep 17 00:00:00 2001 From: Markus <5188411+Noordsestern@users.noreply.github.com> Date: Fri, 18 Nov 2022 13:36:04 +0100 Subject: [PATCH] add timeout to HTTP connections --- Catow/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Catow/main.py b/Catow/main.py index c3cff70..959e55a 100644 --- a/Catow/main.py +++ b/Catow/main.py @@ -32,7 +32,7 @@ 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}¬locked=true&active=true&withRetriesLeft=true') + response = requests.get(f'{CatowConfig().cmd_args.camundaurl}/engine-rest/external-task/count?topicName={CatowConfig().cmd_args.topic}¬locked=true&active=true&withRetriesLeft=true', timeout=(3.05, 5)) response.raise_for_status() #print(response.text) response_body = json.loads(response.text) @@ -40,7 +40,7 @@ async def watch_topic(): 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}')