diff --git a/healthcheck/check_http.py b/healthcheck/check_http.py index 79130ade68a..62141cb8819 100755 --- a/healthcheck/check_http.py +++ b/healthcheck/check_http.py @@ -17,15 +17,13 @@ import urllib.error import urllib.request -TIMEOUT = 2 # seconds - def main(url: str) -> int: try: # Ignore HTTP(S)_PROXY, which Docker may inject into containers: the # target is always the container itself. opener = urllib.request.build_opener(urllib.request.ProxyHandler({})) - body = opener.open(url, timeout=TIMEOUT).read().decode() + body = opener.open(url).read().decode() except urllib.error.HTTPError as exc: print(f"HTTP {exc.code} from {url}", file=sys.stderr) return 1 @@ -33,12 +31,6 @@ def main(url: str) -> int: # urlopen() wraps connection-phase failures (refused, DNS, etc.) here. print(f"{url} unreachable: {exc.reason}", file=sys.stderr) return 1 - except TimeoutError: - # A timeout firing during .read() (after urlopen returns) bubbles up - # as a bare TimeoutError from the underlying socket — not wrapped in - # URLError. Catch it explicitly so the message stays one-line. - print(f"timed out reading {url} after {TIMEOUT}s", file=sys.stderr) - return 1 except OSError as exc: # ConnectionResetError, etc. — anything else from the socket layer. print(f"error against {url}: {exc}", file=sys.stderr)