]> git.mxchange.org Git - fba.git/blobdiff - fetch_instances.py
Continued:
[fba.git] / fetch_instances.py
index 428533692764f8efeb96fc92861cae487ebfb3fe..0975ff4001ddc8f40586bf2c576586bc0fc55539 100644 (file)
@@ -12,11 +12,11 @@ def fetch_instances(domain: str, origin: str):
         print("ERROR: Cannot fetch peers:", domain)
         return
 
-    fba.c.execute(
+    fba.cursor.execute(
         "SELECT domain FROM instances WHERE domain = ? LIMIT 1", [domain]
     )
 
-    if fba.c.fetchone() == None:
+    if fba.cursor.fetchone() == None:
         # NOISY-DEBUG: print("DEBUG: Adding new domain:", domain, origin)
         fba.add_instance(domain, origin, sys.argv[0])
 
@@ -34,15 +34,15 @@ def fetch_instances(domain: str, origin: str):
 
         # NOISY-DEBUG: print("DEBUG: Handling instance:", instance)
         try:
-            fba.c.execute(
+            fba.cursor.execute(
                 "SELECT domain FROM instances WHERE domain = ? LIMIT 1", [instance]
             )
 
-            if fba.c.fetchone() == None:
+            if fba.cursor.fetchone() == None:
                 # NOISY-DEBUG: print("DEBUG: Adding new instance:", instance, domain)
                 fba.add_instance(instance, domain, sys.argv[0])
 
-            fba.conn.commit()
+            fba.connection.commit()
 
         except Exception as e:
             print("ERROR:", e, instance)
@@ -54,11 +54,11 @@ instance = sys.argv[1]
 fetch_instances(instance, None)
 
 # Loop through some instances
-fba.c.execute(
-    "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"]]
+fba.cursor.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"]]
 )
 
-for instance in fba.c.fetchall():
+for instance in fba.cursor.fetchall():
     if fba.is_blacklisted(instance[0]):
         # NOISY-DEBUG: print("DEBUG: domain is blacklisted:", instance)
         continue
@@ -66,4 +66,4 @@ for instance in fba.c.fetchall():
     print("INFO: Fetching instances for instance:", instance[0])
     fetch_instances(instance[0], None)
 
-fba.conn.close()
+fba.connection.close()