From: Roland Häder Date: Sat, 14 Sep 2024 18:43:56 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f58dfb9b1c6f8030e1a2601ddec9325ae9b391af;p=fba.git Continued: - formatted longer SQL statment - changed ordering of records --- diff --git a/fba/commands.py b/fba/commands.py index 62dc297..091ac99 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -85,7 +85,10 @@ def check_nodeinfo(args: argparse.Namespace) -> int: logger.debug("args[]='%s' - CALLED!", type(args)) # Fetch rows - database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE nodeinfo_url IS NOT NULL ORDER BY domain ASC") + database.cursor.execute("SELECT domain, software, nodeinfo_url \ +FROM instances \ +WHERE nodeinfo_url IS NOT NULL \ +ORDER BY domain ASC") cnt = 0 for row in database.cursor.fetchall(): @@ -287,25 +290,17 @@ def fetch_blocks(args: argparse.Namespace) -> int: if args.domain is not None and args.domain != "": # Re-check single domain logger.debug("Querying database for args.domain='%s' ...", args.domain) - database.cursor.execute( - "SELECT domain, software, origin, nodeinfo_url FROM instances WHERE domain = ? LIMIT 1", [args.domain] - ) + database.cursor.execute("SELECT domain, software, origin, nodeinfo_url FROM instances WHERE domain = ? LIMIT 1", [args.domain]) elif args.software is not None and args.software != "": # Re-check single software logger.debug("Querying database for args.software='%s' ...", args.software) - database.cursor.execute( - "SELECT domain, software, origin, nodeinfo_url FROM instances WHERE software = ? ORDER BY total_blocks DESC, last_blocked ASC", [args.software] - ) + database.cursor.execute("SELECT domain, software, origin, nodeinfo_url FROM instances WHERE software = ? ORDER BY last_blocked ASC, total_blocks DESC", [args.software]) elif args.only_none: # Check only entries with total_blocked=None - database.cursor.execute( - "SELECT domain, software, origin, nodeinfo_url FROM instances WHERE software IN ('pleroma', 'mastodon', 'lemmy', 'friendica', 'misskey', 'piefed', 'typecho') AND nodeinfo_url IS NOT NULL AND total_blocks IS NULL ORDER BY last_blocked ASC, total_blocks DESC" - ) + database.cursor.execute("SELECT domain, software, origin, nodeinfo_url FROM instances WHERE software IN ('pleroma', 'mastodon', 'lemmy', 'friendica', 'misskey', 'piefed', 'typecho') AND nodeinfo_url IS NOT NULL AND total_blocks IS NULL ORDER BY last_blocked ASC, total_blocks DESC") else: # Re-check after "timeout" (aka. minimum interval) - database.cursor.execute( - "SELECT domain, software, origin, nodeinfo_url FROM instances WHERE software IN ('pleroma', 'mastodon', 'lemmy', 'friendica', 'misskey', 'piefed', 'typecho') AND nodeinfo_url IS NOT NULL ORDER BY last_blocked ASC, total_blocks DESC" - ) + database.cursor.execute("SELECT domain, software, origin, nodeinfo_url FROM instances WHERE software IN ('pleroma', 'mastodon', 'lemmy', 'friendica', 'misskey', 'piefed', 'typecho') AND nodeinfo_url IS NOT NULL ORDER BY last_blocked ASC, total_blocks DESC") rows = database.cursor.fetchall() logger.info("Checking %d entries ...", len(rows))