]> git.mxchange.org Git - fba.git/commitdiff
Fixed:
authorRoland Häder <roland@mxchange.org>
Sun, 25 Jun 2023 05:22:42 +0000 (07:22 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 25 Jun 2023 05:22:42 +0000 (07:22 +0200)
- don't provide software in advance, this prevents nodeinfo being fetched

fba/commands.py
fba/models/instances.py

index c2695cfac302d95571372cee55fdf517b3df3067..0430ca9a8c861e55b247e24c6ef6ba916070d219 100644 (file)
@@ -444,8 +444,8 @@ def fetch_observer(args: argparse.Namespace) -> int:
                 continue
 
             software = software_helper.alias(software)
-            logger.info("Fetching instances for domain='%s',software='%s'", domain, software)
-            federation.fetch_instances(domain, None, software, inspect.currentframe().f_code.co_name)
+            logger.info("Fetching instances for domain='%s'", domain)
+            federation.fetch_instances(domain, None, None, inspect.currentframe().f_code.co_name)
 
     logger.debug("Success! - EXIT!")
     return 0
index 458196cc0994f6ac1d122422202c9c2b3755a20e..3ba4bd760bec1a0cf58135e0697c6a2a4be327aa 100644 (file)
@@ -282,15 +282,20 @@ def is_registered(domain: str) -> bool:
     logger.debug("registered='%s' - EXIT!", registered)
     return registered
 
-def is_recent(domain: str) -> bool:
-    logger.debug("domain='%s' - CALLED!", domain)
+def is_recent(domain: str, column: str = "last_instance_fetch") -> bool:
+    logger.debug("domain='%s',column='%s' - CALLED!", domain)
     domain_helper.raise_on(domain)
-    if not is_registered(domain):
+
+    if not isinstance(column, str):
+        raise ValueError(f"Parameter column[]='{type(column)}' is not 'str'")
+    elif column not in ["last_instance_fetch", "last_blocks"]:
+        raise ValueError(f"Parameter column='{column}' is not expected")
+    elif not is_registered(domain):
         logger.debug("domain='%s' is not registered, returning False - EXIT!", domain)
         return False
 
     # Query database
-    database.cursor.execute("SELECT last_instance_fetch FROM instances WHERE domain = ? LIMIT 1", [domain])
+    database.cursor.execute(f"SELECT {column} FROM instances WHERE domain = ? LIMIT 1", [domain])
 
     # Fetch row
     fetched = database.cursor.fetchone()[0]