]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 4 Jun 2023 14:06:37 +0000 (16:06 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 4 Jun 2023 14:06:37 +0000 (16:06 +0200)
- retrieving nodeinfo shouldn't take that long

config.defaults.json
fba/fba.py
fba/instances.py

index 1b1cfb78eac2c9c9a1229a73e804f89a8f423d18..9fba2c198088f1f5fa1f7bf7738e362d87cb20d3 100644 (file)
@@ -6,6 +6,8 @@
     "useragent"         : "Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Firefox/113.0",
     "connection_timeout": 30,
     "read_timeout"      : 5,
+    "nodeinfo_connection_timeout": 3,
+    "nodeinfo_read_timeout"      : 2,
     "bot_enabled"       : false,
     "bot_instance"      : "https://example.com",
     "bot_token"         : "",
index 623e5e0664557407d0ffb4f6b0097cc6d582ddc5..a94558e0dde8d96b7a5f165f7452dbdaf596d5bd 100644 (file)
@@ -740,7 +740,7 @@ def fetch_nodeinfo(domain: str, path: str = None) -> list:
 
         try:
             # DEBUG: print("DEBUG: Fetching request:", request)
-            res = reqto.get(request, headers=api_headers, timeout=(config.get("connection_timeout"), config.get("read_timeout")))
+            res = reqto.get(request, headers=api_headers, timeout=(config.get("nodeinfo_connection_timeout"), config.get("nodeinfo_read_timeout")))
 
             data = json_from_response(res)
             # DEBUG: print(f"DEBUG: res.ok={res.ok},res.status_code={res.status_code},data[]='{type(data)}'")
@@ -776,7 +776,7 @@ def fetch_wellknown_nodeinfo(domain: str) -> list:
     data = {}
 
     try:
-        res = reqto.get(f"https://{domain}/.well-known/nodeinfo", headers=api_headers, timeout=(config.get("connection_timeout"), config.get("read_timeout")))
+        res = reqto.get(f"https://{domain}/.well-known/nodeinfo", headers=api_headers, timeout=(config.get("nodeinfo_connection_timeout"), config.get("nodeinfo_read_timeout")))
 
         data = json_from_response(res)
         # DEBUG: print("DEBUG: domain,res.ok,data[]:", domain, res.ok, type(data))
index 8be7a380f1026efcc14abee5711c42780abd69d5..b21e85b2f8a2e8362ecbc49c885f6b5928c8fb80 100644 (file)
@@ -90,7 +90,7 @@ def update_instance_data(domain: str):
     elif not has_pending_instance_data(domain):
         raise Exception(f"Domain '{domain}' has no pending instance data, but function invoked")
 
-    # DEBUG: print(f"DEBUG: Updating nodeinfo for domain='{domain}' ...")
+    # DEBUG: print(f"DEBUG: Updating instance data for domain='{domain}' ...")
     sql_string = ''
     fields = list()
     for key in _pending: