# 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
])
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
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))
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
# 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():