From: Roland Häder Date: Tue, 13 Jun 2023 21:05:52 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f80aedef9fbd187f4edfa4dc7ad65f3b415bb452;p=fba.git Continued: - always add non-existing instances, also when their software type is not detectable, e.g. not existing - also skip recently checked instances --- diff --git a/fba/commands.py b/fba/commands.py index 444f936..dc98d4d 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -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): diff --git a/fba/federation.py b/fba/federation.py index d4959be..17fe0ad 100644 --- a/fba/federation.py +++ b/fba/federation.py @@ -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)