From: Roland Häder Date: Tue, 15 Aug 2023 19:12:43 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=354fb1c21a24c0ab2dea716711ab9c3731de5a2b;p=fba.git Continued: - need to skip recently but unknown instances (software is None but nodeinfo has recently being updated --- diff --git a/fba/http/federation.py b/fba/http/federation.py index 53dff1e..af00643 100644 --- a/fba/http/federation.py +++ b/fba/http/federation.py @@ -59,6 +59,10 @@ def fetch_instances(domain: str, origin: str, software: str, command: str, path: raise ValueError("Parameter 'command' is empty") elif command in ["fetch_blocks", "fetch_cs", "fetch_bkali", "fetch_relays", "fetch_fedipact", "fetch_joinmobilizon", "fetch_joinmisskey", "fetch_joinfediverse"] and origin is None: raise ValueError(f"Parameter command='{command}' but origin is None, please fix invoking this function.") + elif not isinstance(path, str) and path is not None: + raise ValueError(f"Parameter path[]='{type(path)}' is not of type 'str'") + elif instances.is_recent(domain, "last_instance_fetch"): + raise ValueError(f"domain='{domain}' has recently been fetched but function was invoked") elif software is None and not instances.is_recent(domain, "last_nodeinfo"): try: logger.debug("Software for domain='%s' is not set, determining ...", domain) @@ -68,12 +72,10 @@ def fetch_instances(domain: str, origin: str, software: str, command: str, path: instances.set_last_error(domain, exception) logger.debug("Determined software='%s' for domain='%s'", software, domain) + elif software is None: + logger.debug("domain='%s' has unknown software or nodeinfo has recently being fetched", domain) elif not isinstance(software, str): raise ValueError(f"Parameter software[]='{type(software)}' is not of type 'str'") - elif not isinstance(path, str) and path is not None: - raise ValueError(f"Parameter path[]='{type(path)}' is not of type 'str'") - elif instances.is_recent(domain, "last_instance_fetch"): - raise ValueError(f"domain='{domain}' has recently been fetched but function was invoked") logger.debug("Checking if domain='%s' is registered ...", domain) if not instances.is_registered(domain):