"detection_mode": {},
# Found nodeinfo URL
"nodeinfo_url": {},
- # Where to fetch peers (other instances)
- "get_peers_url": {},
}
language_mapping = {
print("WARNING: Did not update any rows:", domain)
except BaseException as e:
- print(f"ERROR: failed SQL query: domain='{domain}',exception:'{str(e)}'")
+ print(f"ERROR: failed SQL query: domain='{domain}',exception[{type(e)}]:'{str(e)}'")
sys.exit(255)
# DEBUG: print("DEBUG: EXIT!")
+def has_pending_nodeinfos(domain: str) -> bool:
+ # DEBUG: print(f"DEBUG: domain='{domain}' - CALLED!")
+ has_pending = False
+ for key in nodeinfos:
+ # DEBUG: print(f"DEBUG: key='{key}',domain='{domain}',nodeinfos[key]='{nodeinfos[key]}'")
+ if domain in nodeinfos[key]:
+ has_pending = True
+ break
+
+ # DEBUG: print(f"DEBUG: has_pending='{has_pending}' - EXIT!")
+ return has_pending
+
def update_nodeinfos(domain: str):
# DEBUG: print("DEBUG: Updating nodeinfo for domain:", domain)
sql_string = ''
print("WARNING: Did not update any rows:", domain)
except BaseException as e:
- print(f"ERROR: failed SQL query: domain='{domain}',sql='{sql}',exception:'{str(e)}'")
+ print(f"ERROR: failed SQL query: domain='{domain}',sql='{sql}',exception[{type(e)}]:'{str(e)}'")
sys.exit(255)
# DEBUG: print("DEBUG: Deleting nodeinfos for domain:", domain)
pending_errors[domain] = res
except BaseException as e:
- print(f"ERROR: failed SQL query: domain='{domain}',exception:'{str(e)}'")
+ print(f"ERROR: failed SQL query: domain='{domain}',exception[{type(e)}]:'{str(e)}'")
sys.exit(255)
# DEBUG: print("DEBUG: EXIT!")
print("WARNING: Did not update any rows:", domain)
except BaseException as e:
- print(f"ERROR: failed SQL query: domain='{domain}',exception:'{str(e)}'")
+ print(f"ERROR: failed SQL query: domain='{domain}',exception[{type(e)}]:'{str(e)}'")
sys.exit(255)
connection.commit()
print("WARNING: Did not update any rows:", domain)
except BaseException as e:
- print(f"ERROR: failed SQL query: domain='{domain}',exception:'{str(e)}'")
+ print(f"ERROR: failed SQL query: domain='{domain}',exception[{type(e)}]:'{str(e)}'")
sys.exit(255)
connection.commit()
# DEBUG: print("DEBUG: EXIT!")
def get_peers(domain: str, software: str) -> list:
- # DEBUG: print("DEBUG: Getting peers for domain:", domain, software)
+ # DEBUG: print(f"DEBUG: domain='{domain}',software='{software}' - CALLED!")
peers = list()
if software == "misskey":
# DEBUG: print(f"DEBUG: domain='{domain}' is misskey, sending API POST request ...")
-
offset = 0
step = config["misskey_offset"]
+
# iterating through all "suspended" (follow-only in its terminology)
# instances page-by-page, since that troonware doesn't support
# sending them all at once
update_last_error(domain, res)
except BaseException as e:
- print(f"WARNING: Exception during fetching JSON: domain='{domain}',exception:'{str(e)}'")
+ print(f"WARNING: Exception during fetching JSON: domain='{domain}',exception[{type(e)}]:'{str(e)}'")
update_last_instance_fetch(domain)
start = start + 100
except BaseException as e:
- print(f"WARNING: Exception during fetching JSON: domain='{domain}',exception:'{str(e)}'")
+ print(f"WARNING: Exception during fetching JSON: domain='{domain}',exception[{type(e)}]:'{str(e)}'")
update_last_instance_fetch(domain)
else:
# DEBUG: print("DEBUG: Querying API was successful:", domain, len(data))
peers = data
- nodeinfos["get_peers_url"][domain] = get_peers_url
except BaseException as e:
print("WARNING: Some error during get():", domain, e)
print("WARNING: Did not update any rows:", domain)
except BaseException as e:
- print(f"ERROR: failed SQL query: reason='{reason}',blocker='{blocker}',blocked='{blocked}',block_level='{block_level}',sql='{sql}',exception:'{str(e)}'")
+ print(f"ERROR: failed SQL query: reason='{reason}',blocker='{blocker}',blocked='{blocked}',block_level='{block_level}',sql='{sql}',exception[{type(e)}]:'{str(e)}'")
sys.exit(255)
# DEBUG: print("DEBUG: EXIT!")
print("WARNING: Did not update any rows:", domain)
except BaseException as e:
- print(f"ERROR: failed SQL query: last_seen='{last_seen}',blocker='{blocker}',blocked='{blocked}',block_level='{block_level}',exception:'{str(e)}'")
+ print(f"ERROR: failed SQL query: last_seen='{last_seen}',blocker='{blocker}',blocked='{blocked}',block_level='{block_level}',exception[{type(e)}]:'{str(e)}'")
sys.exit(255)
# DEBUG: print("DEBUG: EXIT!")
)
except BaseException as e:
- print(f"ERROR: failed SQL query: blocker='{blocker}',blocked='{blocked}',reason='{reason}',block_level='{block_level}',first_seen='{first_seen}',last_seen='{last_seen}',exception:'{str(e)}'")
+ print(f"ERROR: failed SQL query: blocker='{blocker}',blocked='{blocked}',reason='{reason}',block_level='{block_level}',first_seen='{first_seen}',last_seen='{last_seen}',exception[{type(e)}]:'{str(e)}'")
sys.exit(255)
# DEBUG: print("DEBUG: EXIT!")
def is_instance_registered(domain: str) -> bool:
# DEBUG: print(f"DEBUG: domain='{domain}' - CALLED!")
if not is_cache_initialized("is_registered"):
- print(f"DEBUG: Cache for {__name__} not initialized, fetching all rows ...")
+ # DEBUG: print(f"DEBUG: Cache for 'is_registered' not initialized, fetching all rows ...")
try:
cursor.execute("SELECT domain FROM instances")
set_cache_key("is_registered", domain, True)
- for key in nodeinfos:
- # DEBUG: print(f"DEBUG: key='{key}',domain='{domain}',nodeinfos[key]={nodeinfos[key]}")
- if domain in nodeinfos[key]:
- # DEBUG: print(f"DEBUG: domain='{domain}' has pending nodeinfo being updated ...")
- update_nodeinfos(domain)
- remove_pending_error(domain)
- break
+ if has_pending_nodeinfos(domain):
+ # DEBUG: print(f"DEBUG: domain='{domain}' has pending nodeinfo being updated ...")
+ update_nodeinfos(domain)
+ remove_pending_error(domain)
if domain in pending_errors:
# DEBUG: print("DEBUG: domain has pending error being updated:", domain)
remove_pending_error(domain)
except BaseException as e:
- print(f"ERROR: failed SQL query: domain='{domain}',exception:'{str(e)}'")
+ print(f"ERROR: failed SQL query: domain='{domain}',exception[{type(e)}]:'{str(e)}'")
sys.exit(255)
else:
# DEBUG: print("DEBUG: Updating nodeinfo for domain:", domain)