]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 13 Jun 2023 21:05:52 +0000 (23:05 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 13 Jun 2023 21:11:50 +0000 (23:11 +0200)
- always add non-existing instances, also when their software type is not
  detectable, e.g. not existing
- also skip recently checked instances

fba/commands.py
fba/federation.py

index 444f936b77b1319ca6ba26003ede7eb6381abd38..dc98d4d6c3d8b063b9383fd300f1fd778f7678ae 100644 (file)
@@ -101,6 +101,9 @@ def fetch_bkali(args: argparse.Namespace) -> int:
             elif instances.is_registered(entry["domain"]):
                 # DEBUG: print(f"DEBUG: domain='{entry['domain']}' is already registered - SKIPPED!")
                 continue
+            elif instances.is_recent(entry["domain"]):
+                # DEBUG: print(f"DEBUG: domain='{entry['domain']}' has been recently fetched - SKIPPED!")
+                continue
 
             # DEBUG: print(f"DEBUG: Adding domain='{entry['domain']}' ...")
             domains.append(entry["domain"])
@@ -122,7 +125,7 @@ def fetch_bkali(args: argparse.Namespace) -> int:
                 print(f"WARNING: Exception '{type(exception)}' during fetching instances (fetch_bkali) from domain='{domain}'")
                 instances.set_last_error(domain, exception)
 
-    # DEBUG: print("DEBUG: EXIT!")
+    # DEBUG: print("DEBUG: Success - EXIT!")
     return 0
 
 def fetch_blocks(args: argparse.Namespace):
@@ -480,7 +483,7 @@ def fetch_instances(args: argparse.Namespace) -> int:
             print(f"WARNING: Exception '{type(exception)}' during fetching instances (fetch_instances) from domain='{row[0]}'")
             instances.set_last_error(row[0], exception)
 
-    # DEBUG: print("DEBUG: EXIT!")
+    # DEBUG: print("DEBUG: Success - EXIT!")
     return 0
 
 def fetch_oliphant(args: argparse.Namespace):
index d4959be9a149319383d39af6a0d8162f11cb27cd..17fe0ad52f204651eba76b20226a4770b97ff8f5 100644 (file)
@@ -57,7 +57,12 @@ def fetch_instances(domain: str, origin: str, software: str, command: str, path:
         instances.set_last_instance_fetch(domain)
 
         # DEBUG: print(f"DEBUG: software for domain='{domain}' is not set, determining ...")
-        software = determine_software(domain, path)
+        software = None
+        try:
+            software = determine_software(domain, path)
+        except network.exceptions as exception:
+            print(f"DEBUG: Exception '{type(exception)}' during determining software type")
+
         # DEBUG: print(f"DEBUG: Determined software='{software}' for domain='{domain}'")
     elif not isinstance(software, str):
         raise ValueError(f"Parameter software[]='{type(software)}' is not 'str'")
@@ -70,7 +75,8 @@ def fetch_instances(domain: str, origin: str, software: str, command: str, path:
         return
     elif not validators.domain(domain.split("/")[0]):
         raise ValueError(f"domain='{domain}' is not a valid domain")
-    elif not instances.is_registered(domain.split("/")[0]):
+
+    if not instances.is_registered(domain.split("/")[0]):
         # DEBUG: print("DEBUG: Adding new domain:", domain, origin)
         instances.add(domain, origin, command, path)