From c2c69b033253797aea0d366d8cc0efb53a0a7e0f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 20 May 2023 10:45:53 +0200 Subject: [PATCH] Continued: - renamed last_access to last_nodeinfo as fetch_blocks will have its own last access timestamp --- blocks_empty.db | Bin 24576 -> 24576 bytes fba.py | 12 ++++++------ fetch_instances.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/blocks_empty.db b/blocks_empty.db index 63cbd8bcb13fe8542c6ace02ae8aa97dbe6ea710..f6a323c20f6559f7c8030cc64ae9b091767bdbd9 100644 GIT binary patch delta 107 zcmZoTz}Rqrae}nqBL)TrHXw!p{)sxq{Ery)yeIPV>oBnLN-^+CZOmK4!&$||E-o+6 z*yudjls`&RMoyNegvoUWC&%_Beo2T(k eW8_R?Vi%W}XKWOntjrt5stMG`yLk$KP5=P^-xAgU diff --git a/fba.py b/fba.py index fded8ec..49b3897 100644 --- a/fba.py +++ b/fba.py @@ -31,11 +31,11 @@ def get_hash(domain: str) -> str: # NOISY-DEBUG: print("DEBUG: Calculating hash for domain:", domain) return sha256(domain.encode("utf-8")).hexdigest() -def update_last_access(domain: str): - # NOISY-DEBUG: print("DEBUG: Updating last_access for domain:", domain) +def update_last_nodeinfo(domain: str): + # NOISY-DEBUG: print("DEBUG: Updating last_nodeinfo for domain:", domain) try: - c.execute("UPDATE instances SET last_access = ? WHERE domain = ?", [ + c.execute("UPDATE instances SET last_nodeinfo = ? WHERE domain = ?", [ time.time(), domain ]) @@ -55,7 +55,7 @@ def get_peers(domain: str) -> str: print("WARNING: Cannot fetch peers:", domain) if peers is not None: - update_last_access(domain) + update_last_nodeinfo(domain) # NOISY-DEBUG: print("DEBUG: Returning peers[]:", type(peers)) return peers @@ -68,7 +68,7 @@ def post_json_api(domain: str, path: str, data: str) -> list: print("WARNING: Cannot query JSON API:", domain, path, data, res.status_code) raise else: - update_last_access(domain) + update_last_nodeinfo(domain) doc = res.json() # NOISY-DEBUG: print("DEBUG: Returning doc():", len(doc)) @@ -107,7 +107,7 @@ def fetch_nodeinfo(domain: str) -> list: if json is None: print("WARNING: Failed fetching nodeinfo from domain:", domain) else: - update_last_access(domain) + update_last_nodeinfo(domain) # NOISY-DEBUG: print("DEBUG: Returning json():", len(json)) return json diff --git a/fetch_instances.py b/fetch_instances.py index 3797bd3..0f6103e 100644 --- a/fetch_instances.py +++ b/fetch_instances.py @@ -50,7 +50,7 @@ fetch_instances(instance) # Loop through some instances fba.c.execute( - "SELECT domain FROM instances WHERE software IS NOT NULL AND (last_access IS NULL OR last_access < ?) ORDER BY rowid DESC", [time.time() - fba.config["recheck_instance"]] + "SELECT domain FROM instances WHERE software IS NOT NULL AND (last_nodeinfo IS NULL OR last_nodeinfo < ?) ORDER BY rowid DESC", [time.time() - fba.config["recheck_instance"]] ) for instance in fba.c.fetchall(): -- 2.39.5