From: Roland Häder Date: Sun, 10 Dec 2023 23:54:01 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=012f8569a139c8c7393ae519e11bc9a592e6b356;p=fba.git Continued: - also check blacklist in instances.is_recent() function - first check against blacklist, then if it is recent (in commands.py) --- diff --git a/fba/commands.py b/fba/commands.py index 2e36ee4..8ae5722 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -1502,12 +1502,12 @@ def update_nodeinfo(args: argparse.Namespace) -> int: cnt = 0 for row in domains: logger.debug("row[]='%s'", type(row)) - if not args.force and instances.is_recent(row["domain"], "last_nodeinfo"): - logger.debug("row[domain]='%s' has been recently checked - SKIPPED!", row["domain"]) - continue - elif blacklist.is_blacklisted(row["domain"]): + if blacklist.is_blacklisted(row["domain"]): logger.debug("row[domain]='%s' is blacklisted - SKIPPED!", row["domain"]) continue + elif not args.force and instances.is_recent(row["domain"], "last_nodeinfo"): + logger.debug("row[domain]='%s' has been recently checked - SKIPPED!", row["domain"]) + continue try: logger.info("Checking nodeinfo for row[domain]='%s',row[software]='%s' (%s%%) ...", row["domain"], row["software"], "{:5.1f}".format(cnt / len(domains) * 100)) diff --git a/fba/models/instances.py b/fba/models/instances.py index e861281..ab9995f 100644 --- a/fba/models/instances.py +++ b/fba/models/instances.py @@ -338,6 +338,8 @@ def is_recent(domain: str, column: str = "last_instance_fetch") -> bool: raise ValueError(f"Parameter column[]='{type(column)}' is not of type 'str'") elif not column.startswith("last_"): raise ValueError(f"Parameter column='{column}' is not expected") + elif blacklist.is_blacklisted(domain): + raise ValueError(f"domain='{domain}' is blacklisted but function was invoked") elif not is_registered(domain): logger.debug("domain='%s' is not registered, returning False - EXIT!", domain) return False