]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 29 Apr 2025 19:36:46 +0000 (21:36 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 29 Apr 2025 19:36:46 +0000 (21:36 +0200)
- ops, `value` is no parameter in daemon's function
- introduced --force-recrawl (to include recently crawled instances) parameter
  to 2 commands
- updated --force-all help text

daemon.py
fba/boot.py
fba/commands.py

index f007e726b6bbda6a3e6a1ab58493b0b2e9985190..98fce7e01891db2fe169cdb48cc36fab0b971f0b 100755 (executable)
--- a/daemon.py
+++ b/daemon.py
@@ -83,7 +83,7 @@ SELECT COUNT(domain) FROM instances) AS total_websites, \
 
 @router.get(_base_url + "/api/scoreboard.json", response_class=JSONResponse)
 def api_scoreboard(mode: str, amount: int) -> None:
-    if mode is None or value is None or amount is None:
+    if mode is None or amount is None:
         raise HTTPException(status_code=500, detail="No filter specified")
     elif amount <= 0:
         raise HTTPException(status_code=500, detail=f"amount={amount} is to small")
index f25ea984c2a980b76606f7533180c8a7ee9453c0..5730b1683eccc9a2fdb75537d200e08c5550648d 100644 (file)
@@ -148,7 +148,8 @@ def init_parser() -> None:
     )
     parser.set_defaults(command=commands.fetch_instances)
     parser.add_argument("--domain", help="Instance name (aka. domain) to fetch further instances from. Start with a large instance, for example mastodon.social .")
-    parser.add_argument("--force-all", action="store_true", help="Include also already existing instances, otherwise only new are checked")
+    parser.add_argument("--force-all", action="store_true", help="Forces update of data, no matter what. Replaces all force parameters below.")
+    parser.add_argument("--force-recrawl", action="store_true", help="Forces recrawling all found instances. Can still be limited by --software or any --no-* parameters.")
     parser.add_argument("--software", help="Name of software, for example 'lemmy'")
 
     ### Fetch blocks from static text file(s) ###
@@ -157,7 +158,8 @@ def init_parser() -> None:
         help="Fetches text/plain files as simple domain lists",
     )
     parser.set_defaults(command=commands.fetch_txt)
-    parser.add_argument("--force-all", action="store_true", help="Forces update of data, no matter what.")
+    parser.add_argument("--force-all", action="store_true", help="Forces update of data, no matter what. Replaces all force parameters below.")
+    parser.add_argument("--force-recrawl", action="store_true", help="Forces recrawling all found instances. Can still be limited by --software or any --no-* parameters.")
 
     ### Fetch blocks from joinfediverse.wiki ###
     #parser = subparser_command.add_parser(
index d48a769742d6e0f5825448d8d8f4c78c038e920d..adc2c87d9e97ffb219ca37060e761631e9e2aa19 100644 (file)
@@ -1071,7 +1071,7 @@ ORDER BY total_peers DESC, last_response_time ASC, last_updated ASC"
         elif software_helper.is_relay(row["software"]):
             logger.warning("row[domain]='%s' is a relay of type '%s' which is not supported by this command. Please invoke fetch_relays instead - SKIPPED!", row["domain"], row["software"])
             continue
-        elif not args.force_all and not args.software in [None, ""] and instances.is_recent(row["domain"]):
+        elif not args.force_all and not args.force_recrawl and instances.is_recent(row["domain"]):
             logger.debug("row[domain]='%s' has recently been crawled - SKIPPED!", row["domain"])
             continue
 
@@ -1174,7 +1174,7 @@ def fetch_txt(args: argparse.Namespace) -> int:
                 elif not domain_helper.is_wanted(domain):
                     logger.debug("domain='%s' is not wanted - SKIPPED!", domain)
                     continue
-                elif not args.force_all and instances.is_registered(domain):
+                elif not args.force_all and not args.force_recrawl and instances.is_registered(domain):
                     logger.debug("domain='%s' is already registered - SKIPPED!", domain)
                     continue