]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 20 Nov 2023 00:45:15 +0000 (01:45 +0100)
committerRoland Häder <roland@mxchange.org>
Mon, 20 Nov 2023 00:45:15 +0000 (01:45 +0100)
- more named parameters
- added some debug/warning lines

fba/http/network.py
fba/http/nodeinfo.py

index 3b5542ee3a9da47c4fd45c9b119ee0b00ee6f2c2..1982957dd08794f813d453a6608696fe1af1bacd 100644 (file)
@@ -210,6 +210,7 @@ def send_bot_post(domain: str, blocklist: list):
     truncated = False
 
     if len(blocklist) > 20:
+        logger.warning("blocklist()=%d for domain='%s' has more than 20 records, truncating to 20 ...", len(blocklist), domain)
         truncated = True
         blocklist = blocklist[0 : 19]
 
@@ -268,12 +269,10 @@ def fetch_response(domain: str, path: str, headers: dict, timeout: tuple, allow_
             allow_redirects=allow_redirects
         )
         response_time = time.perf_counter() - start
-        logger.debug("response_time=%s", response_time)
-
+        logger.debug("Setting response_time=%s for domain='%s' ...", response_time, domain)
         instances.set_last_response_time(domain, response_time)
 
         logger.debug("response.ok='%s',response.status_code=%d,response.reason='%s',response_time=%s", response.ok, response.status_code, response.reason, response_time)
-
     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)
index 5626812a29c776532d7408a0a456ec39c89b207b..341a15fbb684925e59d658ce3e93c15d3a705a6b 100644 (file)
@@ -91,16 +91,21 @@ def fetch(domain: str, path: str = None, update_mode: bool = True) -> dict:
             data = network.get_json_api(
                 domain,
                 request,
-                headers,
-                (config.get("nodeinfo_connection_timeout"), config.get("nodeinfo_read_timeout"))
+                headers=headers,
+                timeout=(config.get("nodeinfo_connection_timeout"), config.get("nodeinfo_read_timeout"))
             )
 
             logger.debug("data[]='%s'", type(data))
             if "error_message" not in data and "json" in data:
-                logger.debug("Success: request='%s' - Setting detection_mode=STATIC_CHECK ...", request)
+                logger.debug("Updating last_nodeinfo for domain='%s' ....", domain)
                 instances.set_last_nodeinfo(domain)
+
+                logger.debug("update_mode='%s'", update_mode)
                 if update_mode:
+                    logger.debug("Success: request='%s' - Setting detection_mode=STATIC_CHECK for domain='%s' ...", request, domain)
                     instances.set_detection_mode(domain, "STATIC_CHECK")
+
+                    logger.debug("domain='%s',request='%s'", domain, request)
                     instances.set_nodeinfo_url(domain, "https://{domain}{request}")
                 break