From 59b5719c00a021d3dcd1f1a80e03c8323971c72e Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Sat, 7 May 2022 12:11:22 +0200 Subject: [PATCH] [IMP]Uptime check : default timeout to 9; configurable --- uptime/check/check.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/uptime/check/check.py b/uptime/check/check.py index 530157a..d8bc1a2 100644 --- a/uptime/check/check.py +++ b/uptime/check/check.py @@ -9,9 +9,9 @@ from requests import get, post from config import HC_ROOT, CONFIG -def check_domain(domain): +def check_domain(domain, timeout): try: - r = get('https://%s' % domain, timeout=6) + r = get('https://%s' % domain, timeout=timeout) except Exception as e: return (e, 0) return (r.status_code, r.elapsed) @@ -29,7 +29,7 @@ for check_item in CONFIG: fail = False data = [] for domain in check_item['domains']: - (status, timed) = check_domain(domain) + (status, timed) = check_domain(domain, check_item.get('timeout', 9)) if not fail and status != 200: fail = True if isinstance(status, Exception):