From: Roland Häder Date: Tue, 21 Nov 2023 18:52:38 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e3514bca65c3cf145a9eb923939d9284b06ed1ba;p=fba.git Continued: - also track response time during raised exceptions --- diff --git a/fba/http/federation.py b/fba/http/federation.py index c17e52d..b48255d 100644 --- a/fba/http/federation.py +++ b/fba/http/federation.py @@ -96,11 +96,8 @@ def fetch_instances(domain: str, origin: str, software: str, command: str, path: peerlist = list() logger.debug("software='%s'", software) if software is not None: - try: - logger.debug("Fetching instances for domain='%s',software='%s',origin='%s'", domain, software, origin) - peerlist = fetch_peers(domain, software, origin) - except network.exceptions as exception: - logger.warning("Cannot fetch peers from domain='%s',software='%s': '%s'", domain, software, type(exception)) + logger.debug("Fetching instances for domain='%s',software='%s',origin='%s'", domain, software, origin) + peerlist = fetch_peers(domain, software, origin) logger.debug("peerlist[]='%s'", type(peerlist)) if isinstance(peerlist, list): diff --git a/fba/http/network.py b/fba/http/network.py index 1982957..91397f9 100644 --- a/fba/http/network.py +++ b/fba/http/network.py @@ -258,6 +258,7 @@ def fetch_response(domain: str, path: str, headers: dict, timeout: tuple, allow_ elif not isinstance(timeout, tuple): raise ValueError(f"timeout[]='{type(timeout)}' is not of type 'tuple'") + start = 0 try: logger.debug("Sending GET request to '%s%s' ...", domain, path) start = time.perf_counter() @@ -276,6 +277,11 @@ def fetch_response(domain: str, path: str, headers: dict, timeout: tuple, allow_ except exceptions as exception: logger.debug("Fetching path='%s' from domain='%s' failed. exception[%s]='%s'", path, domain, type(exception), str(exception)) instances.set_last_error(domain, exception) + + response_time = time.perf_counter() - start + logger.debug("Setting response_time=%s for domain='%s' ...", response_time, domain) + instances.set_last_response_time(domain, response_time) + raise exception logger.debug("response[]='%s' - EXIT!", type(response))