]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 8 Jul 2023 21:06:22 +0000 (23:06 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 8 Jul 2023 21:06:22 +0000 (23:06 +0200)
- also update `last_nodeinfo` when nodeinfo has been auto-discovered or found by
  probing their also well-known locations

fba/http/federation.py

index 8a0a2258b50ccc643c0acf4d89c723e494a7d91a..74edbd7a9f9818c3d7ff753843f8ed1fde161dae 100644 (file)
@@ -214,6 +214,9 @@ def fetch_nodeinfo(domain: str, path: str = None) -> dict:
 
     logger.debug("nodeinfo[%s](%d='%s'", type(nodeinfo), len(nodeinfo), nodeinfo)
     if "error_message" not in nodeinfo and "json" in nodeinfo and len(nodeinfo["json"]) > 0:
+        logger.debug("Invoking instances.set_last_nodeinfo(%s) ...", domain)
+        instances.set_last_nodeinfo(domain)
+
         logger.debug("Found nodeinfo[json]()=%d - EXIT!", len(nodeinfo['json']))
         return nodeinfo
 
@@ -253,12 +256,13 @@ def fetch_nodeinfo(domain: str, path: str = None) -> dict:
 
         logger.debug("path[%s]='%s',request='%s',http_url='%s',https_url='%s'", type(path), path, request, http_url, https_url)
         if path is None or path in [request, http_url, https_url]:
-            logger.debug("Fetching request='%s' from domain='%s' ...", request, domain)
+            logger.debug("path='%s',http_url='%s',https_url='%s'", path, http_url, https_url)
             if path in [http_url, https_url]:
                 logger.debug("domain='%s',path='%s' has protocol in path, splitting ...", domain, path)
                 components = urlparse(path)
                 path = components.path
 
+            logger.debug("Fetching request='%s' from domain='%s' ...", request, domain)
             data = network.get_json_api(
                 domain,
                 request,
@@ -269,6 +273,7 @@ def fetch_nodeinfo(domain: str, path: str = None) -> dict:
             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)
+                instances.set_last_nodeinfo(domain)
                 instances.set_detection_mode(domain, "STATIC_CHECK")
                 instances.set_nodeinfo_url(domain, request)
                 break