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
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]