From: Roland Häder Date: Sat, 20 May 2023 08:45:53 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c2c69b033253797aea0d366d8cc0efb53a0a7e0f;p=fba.git Continued: - renamed last_access to last_nodeinfo as fetch_blocks will have its own last access timestamp --- diff --git a/blocks_empty.db b/blocks_empty.db index 63cbd8b..f6a323c 100644 Binary files a/blocks_empty.db and b/blocks_empty.db differ 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():