From: Roland Häder Date: Sun, 10 Dec 2023 05:15:09 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1e032298d62f8d8e163bc0b64d94b44d448e3738;p=fba.git Continued: - some relays may have removed/never set nodeinfo URL, these need to be skipped to avoid exception in fetch_url() function --- diff --git a/fba/commands.py b/fba/commands.py index 29e78ba..c87e624 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -1692,24 +1692,31 @@ def fetch_relays(args: argparse.Namespace) -> int: locking.acquire() if args.domain is not None and args.domain != "": + logger.debug("Fetching instances record for args.domain='%s' ...", args.domain) database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE software IN ('activityrelay', 'aoderelay', 'selective-relay', 'pub-relay') AND domain = ? LIMIT 1", [args.domain]) elif args.software is not None and args.software != "": - database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE software IN ('activityrelay', 'aoderelay', 'selective-relay', 'pub-relay') AND software = ?", [args.software]) + logger.debug("Fetching instances records for args.software='%s' ...", args.software) + database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE software IN ('activityrelay', 'aoderelay', 'selective-relay', 'pub-relay') AND nodeinfo_url IS NOT NULL AND software = ? ORDER BY last_updated DESC", [args.software]) else: - database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE software IN ('activityrelay', 'aoderelay', 'selective-relay', 'pub-relay')") + logger.debug("Fetch all relay instances ...") + database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE software IN ('activityrelay', 'aoderelay', 'selective-relay', 'pub-relay') AND nodeinfo_url IS NOT NULL ORDER BY last_updated DESC") domains = list() rows = database.cursor.fetchall() logger.info("Checking %d relays ...", len(rows)) for row in rows: - logger.debug("row[domain]='%s',row[software]='%s' ...", row["domain"], row["software"]) + logger.debug("row[domain]='%s',row[software]='%s'", row["domain"], row["software"]) if not args.force and instances.is_recent(row["domain"]): logger.debug("row[domain]='%s' has been recently fetched - SKIPPED!", row["domain"]) continue + elif row["nodeinfo_url"] is None: + logger.warning("row[domain]='%s' has empty nodeinfo_url but this is required - SKIPPED!", row["domain"]) + continue peers = list() try: + logger.debug("row[domain]='%s',row[software]='%s' - checking ....", row["domain"], row["software"]) if row["software"] == "pub-relay": logger.info("Fetching row[nodeinfo_url]='%s' from relay row[domain]='%s',row[software]='%s' ...", row["nodeinfo_url"], row["domain"], row["software"]) raw = network.fetch_api_url(