]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 24 May 2023 05:23:50 +0000 (07:23 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 24 May 2023 05:24:30 +0000 (07:24 +0200)
- if fetching nodeinfo was successful, then clear any status codes and error
  messages for this instance
- also tidyup() found instance, some are invalid :-(

fba.py
fetch_instances.py

diff --git a/fba.py b/fba.py
index aa9c1ab5ecb9d8f5d1ead0f40d99529016c3f89c..79adabf1ae905d0c1134537c1c1644b2a05b8cec 100644 (file)
--- a/fba.py
+++ b/fba.py
@@ -104,11 +104,10 @@ def update_nodeinfos(domain: str):
            fields.append(nodeinfos[key][domain])
            sql_string += f" {key} = ?,"
 
-    sql_string = sql_string[:-1]
     fields.append(domain)
     # NOISY-DEBUG: print(f"DEBUG: sql_string='{sql_string}',fields()={len(fields)}")
 
-    sql = "UPDATE instances SET" + sql_string + " WHERE domain = ? LIMIT 1"
+    sql = "UPDATE instances SET" + sql_string + " last_status_code = NULL, last_error_details = NULL WHERE domain = ? LIMIT 1"
     # NOISY-DEBUG: print("DEBUG: sql:", sql)
 
     try:
@@ -501,8 +500,12 @@ def add_instance(domain: str, origin: str, originator: str):
         if domain in nodeinfos["nodeinfo_url"]:
             # NOISY-DEBUG # NOISY-DEBUG: print("DEBUG: domain has pending nodeinfo being updated:", domain)
             update_nodeinfos(domain)
-
-        if domain in pending_errors:
+            try:
+                # Prevent updating any pending errors, nodeinfo was found
+                del pending_errors[domain]
+            except:
+                pass
+        elif domain in pending_errors:
             # NOISY-DEBUG: print("DEBUG: domain has pending error being updated:", domain)
             update_last_error(domain, pending_errors[domain])
             del pending_errors[domain]
index 635cc1c2421f0d1b4cb6e6aee8eaf1385d4bf460..6b8a8d81f27af6b13f3554950e4a2693cd6eea09 100644 (file)
@@ -27,9 +27,14 @@ def fetch_instances(domain: str, origin: str, software: str):
 
     print(f"INFO: Checking {len(peerlist)} instances from {domain} ...")
     for instance in peerlist:
-        instance = instance.lower()
+        # NOISY-DEBUG: print("DEBUG: BEFORE instance:", instance)
+        instance = fba.tidyup(instance)
+        # NOISY-DEBUG: print("DEBUG: AFTER instance:", instance)
 
-        if not validators.domain(instance):
+        if instance == "":
+            print("WARNING: Empty instance after tidyup(), domain:", domain)
+            continue
+        elif not validators.domain(instance):
             print("WARNING: Bad instance name,domain:", instance, domain)
             continue
         elif fba.is_blacklisted(instance):