Use more strict exception checking

This is probably wide enough and we do not need weird extra handling of
our own execption etc.

Thanks to @mickenordin for keeping me honest :).
This commit is contained in:
Patrik Lundin 2024-06-17 12:40:12 +02:00
parent 4b8b8887f6
commit e315282bc5
Signed by untrusted user: patlu
GPG key ID: A0A812BA2249F294

View file

@ -97,10 +97,7 @@ def do_fleetlock_request(
timeout=args.request_timeout, timeout=args.request_timeout,
auth=("", config[args.lock_group]["password"]), auth=("", config[args.lock_group]["password"]),
) )
except Exception as e: # pylint: disable=broad-exception-caught except requests.exceptions.ConnectionError as e:
if isinstance(e, TimeoutException):
# This means our global timer is up, no more time to retry
raise e
print(f"POST request failed: {e}") print(f"POST request failed: {e}")
time.sleep(retry_sleep_delay) time.sleep(retry_sleep_delay)
continue continue