From: Roland Häder Date: Mon, 21 Apr 2025 00:15:49 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4075029e24a0b127b02afe89b429eff51ccea452;p=fba.git Continued: - no need to convert existing domain again, let's take row[domain] directly - formatted SQL command --- diff --git a/fba/commands.py b/fba/commands.py index 011cae1..22eefbd 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -1078,31 +1078,35 @@ def fetch_instances(args: argparse.Namespace) -> int: database.cursor.execute( "SELECT domain, origin, software \ FROM instances \ -WHERE software IN ('pleroma', 'mastodon', 'friendica', 'misskey', 'lemmy', 'peertube', 'takahe', 'gotosocial', 'brighteon', 'wildebeest', 'bookwyrm', 'mitra', 'areionskey', 'mammuthus', 'neodb', 'smithereen', 'vebinet', 'toki', 'snac', 'biblioreads', 'wordpress', 'oolong', 'diaspora', 'appy') \ +WHERE software IN ( \ + 'pleroma' , 'mastodon', 'friendica' , 'misskey' , 'lemmy' , \ + 'peertube' , 'takahe' , 'gotosocial', 'brighteon', 'wildebeest' , \ + 'bookwyrm' , 'mitra ', 'areionskey', 'mammuthus', 'neodb' , \ + 'smithereen', 'vebinet' , 'toki' , 'snac' , 'biblioreads', \ + 'wordpress' , 'oolong' , 'diaspora' , 'appy' \ +) \ ORDER BY total_peers DESC, last_response_time ASC, last_updated ASC" ) rows = database.cursor.fetchall() logger.info("Checking %d entries ...", len(rows)) for row in rows: - logger.debug("row[domain]='%s' - BEFORE!", row["domain"]) - domain = domain_helper.encode_idna(row["domain"]) - logger.debug("domain='%s' - AFTER!", domain) + logger.debug("row[domain]='%s'", row["domain"]) - if not domain_helper.is_wanted(domain): - logger.debug("domain='%s' is not wanted - SKIPPED!", domain) + if not domain_helper.is_wanted(row["domain"]): + logger.warning("row[domain]='%s' is not wanted, you should execute remove_invalid for cleaning your database - SKIPPED!", row["domain"]) continue - elif instances.is_recent(domain): - logger.debug("domain='%s' has recently been crawled - SKIPPED!") + elif instances.is_recent(row["domain"]): + logger.debug("row[domain]='%s' has recently been crawled - SKIPPED!", row["domain"]) continue try: - logger.info("Fetching instances for domain='%s',origin='%s',software='%s' ...", domain, row["origin"], row["software"]) - federation.fetch_instances(domain, row["origin"], row["software"], inspect.currentframe().f_code.co_name) + logger.info("Fetching instances for row[domain]='%s',origin='%s',software='%s' ...", row["domain"], row["origin"], row["software"]) + federation.fetch_instances(row["domain"], row["origin"], row["software"], inspect.currentframe().f_code.co_name) except network.exceptions as exception: - logger.warning("Exception '%s' during fetching instances (fetch_instances) from domain='%s'", type(exception), domain) - instances.set_last_error(domain, exception) - instances.update(domain) + logger.warning("Exception '%s' during fetching instances (fetch_instances) from row[domain]='%s'", type(exception), row["domain"]) + instances.set_last_error(row["domain"], exception) + instances.update(row["domain"]) logger.debug("Success - EXIT!") return 0 @@ -1119,7 +1123,7 @@ def fetch_csv(args: argparse.Namespace) -> int: # Is domain given and not equal blocker? if isinstance(args.domain, str) and args.domain != block["blocker"]: - logger.debug("Skipping blocker='%s', not matching args.domain='%s'", block["blocker"], args.domain) + logger.debug("block[blocker]='%s' does not match args.domain='%s' - SKIPPED!", block["blocker"], args.domain) continue logger.debug("Invoking processing.csv_block(%s, %s, fetch_csv) ...", block["blocker"], block["csv_url"])