From: Roland Häder Date: Sun, 25 Jun 2023 05:22:42 +0000 (+0200) Subject: Fixed: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d037a76f2aa01fc9853af1525b7cb8e869bbccd1;p=fba.git Fixed: - don't provide software in advance, this prevents nodeinfo being fetched --- diff --git a/fba/commands.py b/fba/commands.py index c2695cf..0430ca9 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -444,8 +444,8 @@ def fetch_observer(args: argparse.Namespace) -> int: continue software = software_helper.alias(software) - logger.info("Fetching instances for domain='%s',software='%s'", domain, software) - federation.fetch_instances(domain, None, software, inspect.currentframe().f_code.co_name) + logger.info("Fetching instances for domain='%s'", domain) + federation.fetch_instances(domain, None, None, inspect.currentframe().f_code.co_name) logger.debug("Success! - EXIT!") return 0 diff --git a/fba/models/instances.py b/fba/models/instances.py index 458196c..3ba4bd7 100644 --- a/fba/models/instances.py +++ b/fba/models/instances.py @@ -282,15 +282,20 @@ def is_registered(domain: str) -> bool: logger.debug("registered='%s' - EXIT!", registered) return registered -def is_recent(domain: str) -> bool: - logger.debug("domain='%s' - CALLED!", domain) +def is_recent(domain: str, column: str = "last_instance_fetch") -> bool: + logger.debug("domain='%s',column='%s' - CALLED!", domain) domain_helper.raise_on(domain) - if not is_registered(domain): + + if not isinstance(column, str): + raise ValueError(f"Parameter column[]='{type(column)}' is not 'str'") + elif column not in ["last_instance_fetch", "last_blocks"]: + raise ValueError(f"Parameter column='{column}' is not expected") + elif not is_registered(domain): logger.debug("domain='%s' is not registered, returning False - EXIT!", domain) return False # Query database - database.cursor.execute("SELECT last_instance_fetch FROM instances WHERE domain = ? LIMIT 1", [domain]) + database.cursor.execute(f"SELECT {column} FROM instances WHERE domain = ? LIMIT 1", [domain]) # Fetch row fetched = database.cursor.fetchone()[0]