]> git.mxchange.org Git - fba.git/blobdiff - fetch_instances.py
Continued:
[fba.git] / fetch_instances.py
index 3a2733847c570b859eb129f586296067098d2a86..428533692764f8efeb96fc92861cae487ebfb3fe 100644 (file)
@@ -23,17 +23,13 @@ def fetch_instances(domain: str, origin: str):
     print(f"INFO: Checking {len(peerlist)} instances from {domain} ...")
     for instance in peerlist:
         instance = instance.lower()
+
         if instance.find("@") > 0:
             print("WARNING: Bad instance name,domain:", instance, domain)
             continue
 
-        blacklisted = False
-        for peer in fba.blacklist:
-            if peer in instance:
-                blacklisted = True
-
-        if blacklisted:
-            # NOISY-DEBUG: print("DEBUG: domain is blacklisted:", domain)
+        if fba.is_blacklisted(instance):
+            # NOISY-DEBUG: print("DEBUG: instance is blacklisted:", instance)
             continue
 
         # NOISY-DEBUG: print("DEBUG: Handling instance:", instance)
@@ -59,16 +55,11 @@ fetch_instances(instance, None)
 
 # Loop through some instances
 fba.c.execute(
-    "SELECT domain FROM instances WHERE software IN ('pleroma', 'mastodon', 'friendica', 'misskey', 'gotosocial') AND (last_nodeinfo IS NULL OR last_nodeinfo < ?) ORDER BY rowid DESC", [time.time() - fba.config["recheck_instance"]]
+    "SELECT domain FROM instances WHERE software IN ('pleroma', 'mastodon', 'friendica', 'misskey', 'gotosocial') AND (software IS NULL OR last_nodeinfo IS NULL OR last_nodeinfo < ?) ORDER BY rowid DESC", [time.time() - fba.config["recheck_instance"]]
 )
 
 for instance in fba.c.fetchall():
-    blacklisted = False
-    for domain in fba.blacklist:
-        if domain in instance[0]:
-            blacklisted = True
-
-    if blacklisted:
+    if fba.is_blacklisted(instance[0]):
         # NOISY-DEBUG: print("DEBUG: domain is blacklisted:", instance)
         continue