]> git.mxchange.org Git - fba.git/commitdiff
Fixed:
authorRoland Häder <roland@mxchange.org>
Sun, 9 Jul 2023 17:47:11 +0000 (19:47 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 9 Jul 2023 17:47:11 +0000 (19:47 +0200)
- ops, to much renames, named 'domains' back to 'blocklist'
- also need to check combined arrays, or else always 2 will be found
- need to invoke commit() in sources.update() function

fba/commands.py
fba/models/sources.py

index f6031343fc3515f61eefb6b7f28cd0af65c1ad17..a2cbe6fb0b2f25876282a2e1f565f908fd020553 100644 (file)
@@ -632,7 +632,7 @@ def fetch_cs(args: argparse.Namespace):
         "wikilinks"
     ]
 
-    domains = {
+    blocklist = {
         "silenced": list(),
         "reject"  : list(),
     }
@@ -653,11 +653,11 @@ def fetch_cs(args: argparse.Namespace):
 
     silenced = doc.find("h2", {"id": "silenced-instances"}).findNext("table").find("tbody")
     logger.debug("silenced[%s]()=%d", type(silenced), len(silenced))
-    domains["silenced"] = federation.find_domains(silenced)
+    blocklist["silenced"] = federation.find_domains(silenced)
 
     blocked = doc.find("h2", {"id": "blocked-instances"}).findNext("table").find("tbody")
     logger.debug("blocked[%s]()=%d", type(blocked), len(blocked))
-    domains["reject"] = federation.find_domains(blocked)
+    blocklist["reject"] = federation.find_domains(blocked)
 
     blocking = blocklist["silenced"] + blocklist["reject"]
     blocker = "chaos.social"
@@ -665,14 +665,13 @@ def fetch_cs(args: argparse.Namespace):
     logger.debug("Invoking instances.set_total_blocks(%s, %d) ...", blocker, len(blocking))
     instances.set_total_blocks(blocker, blocking)
 
-    logger.debug("domains[silenced]()=%d,domains[reject]()=%d", len(domains["silenced"]), len(domains["reject"]))
+    logger.debug("blocklist[silenced]()=%d,blocklist[reject]()=%d", len(blocklist["silenced"]), len(blocklist["reject"]))
     blockdict = list()
-    if len(domains) > 0:
-
-        for block_level in domains:
-            logger.info("block_level='%s' has %d row(s)", block_level, len(domains[block_level]))
+    if len(blocking) > 0:
+        for block_level in blocklist:
+            logger.info("block_level='%s' has %d row(s)", block_level, len(blocklist[block_level]))
 
-            for row in domains[block_level]:
+            for row in blocklist[block_level]:
                 logger.debug("row[%s]='%s'", type(row), row)
                 if instances.is_recent(row["domain"], "last_blocked"):
                     logger.debug("row[domain]='%s' has been recently crawled - SKIPPED!", row["domain"])
index 55ace8161c98cff6436a021991677c665760ba3d..75ddcf4971a8389c8249b84d97d76b1a2c363c2c 100644 (file)
@@ -70,4 +70,7 @@ def update (source_domain: str):
             source_domain
         ])
 
+    logger.debug("Invoking commit() ...")
+    database.connection.commit()
+
     logger.debug("EXIT!")