elif type(software) != str and software != None:
raise ValueError(f"software[]={type(software)} is not 'str'")
- # 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.get("misskey_offset")
+ step = config.get("misskey_limit")
# iterating through all "suspended" (follow-only in its terminology)
# instances page-by-page, since that troonware doesn't support
"offset": offset - 1
}), {"Origin": domain})
- # DEBUG: print("DEBUG: fetched():", len(fetched))
+ # DEBUG: print(f"DEBUG: fetched()={len(fetched))}")
if len(fetched) == 0:
# DEBUG: print("DEBUG: Returned zero bytes, exiting loop:", domain)
break
- elif len(fetched) != config.get("misskey_offset"):
- # DEBUG: print(f"DEBUG: Fetched '{len(fetched)}' row(s) but expected: '{config.get('misskey_offset')}'")
- offset = offset + (config.get("misskey_offset") - len(fetched))
+ elif len(fetched) != config.get("misskey_limit"):
+ # DEBUG: print(f"DEBUG: Fetched '{len(fetched)}' row(s) but expected: '{config.get('misskey_limit')}'")
+ offset = offset + (config.get("misskey_limit") - len(fetched))
else:
# DEBUG: print("DEBUG: Raising offset by step:", step)
offset = offset + step
update_last_error(domain, fetched["error"]["message"])
break
+ already = 0
for row in fetched:
# DEBUG: print(f"DEBUG: row():{len(row)}")
if not "host" in row:
elif is_blacklisted(row["host"]):
# DEBUG: print(f"DEBUG: row[host]='{row['host']}' is blacklisted. domain='{domain}'")
continue
+ elif row["host"] in peers:
+ # DEBUG: print(f"DEBUG: Not adding row[host]='{row['host']}', already found.")
+ already = already + 1
+ continue
# DEBUG: print(f"DEBUG: Adding peer: '{row['host']}'")
peers.append(row["host"])
+ if already == len(fetched):
+ print(f"WARNING: Host returned same set of '{already}' instances, aborting loop!")
+ break
+
# DEBUG: print(f"DEBUG: Adding '{len(peers)}' for domain='{domain}'")
instances.set_instance_data("total_peers", domain, len(peers))
}
offset = 0
- step = config.get("misskey_offset")
+ step = config.get("misskey_limit")
while True:
# iterating through all "suspended" (follow-only in its terminology)
# instances page-by-page, since that troonware doesn't support
if len(fetched) == 0:
# DEBUG: print("DEBUG: Returned zero bytes, exiting loop:", domain)
break
- elif len(fetched) != config.get("misskey_offset"):
- # DEBUG: print(f"DEBUG: Fetched '{len(fetched)}' row(s) but expected: '{config.get('misskey_offset')}'")
- offset = offset + (config.get("misskey_offset") - len(fetched))
+ elif len(fetched) != config.get("misskey_limit"):
+ # DEBUG: print(f"DEBUG: Fetched '{len(fetched)}' row(s) but expected: '{config.get('misskey_limit')}'")
+ offset = offset + (config.get("misskey_limit") - len(fetched))
else:
# DEBUG: print("DEBUG: Raising offset by step:", step)
offset = offset + step
if len(fetched) == 0:
# DEBUG: print("DEBUG: Returned zero bytes, exiting loop:", domain)
break
- elif len(fetched) != config.get("misskey_offset"):
- # DEBUG: print(f"DEBUG: Fetched '{len(fetched)}' row(s) but expected: '{config.get('misskey_offset')}'")
- offset = offset + (config.get("misskey_offset") - len(fetched))
+ elif len(fetched) != config.get("misskey_limit"):
+ # DEBUG: print(f"DEBUG: Fetched '{len(fetched)}' row(s) but expected: '{config.get('misskey_limit')}'")
+ offset = offset + (config.get("misskey_limit") - len(fetched))
else:
# DEBUG: print("DEBUG: Raising offset by step:", step)
offset = offset + step
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-from fba import fba
import sys
+import time
+
+from fba import fba
# Found info from node, such as nodeinfo URL, detection mode that needs to be
# written to database. Both arrays must be filled at the same time or else
fields.append(_pending[key][domain])
sql_string += f" {key} = ?,"
+ fields.append(time.time())
fields.append(domain)
if sql_string == '':
raise ValueError(f"No fields have been set, but method invoked, domain='{domain}'")
# DEBUG: print(f"DEBUG: sql_string='{sql_string}',fields()={len(fields)}")
- sql_string = "UPDATE instances SET" + sql_string + " last_updated = TIME() WHERE domain = ? LIMIT 1"
+ sql_string = "UPDATE instances SET" + sql_string + " last_updated = ? WHERE domain = ? LIMIT 1"
# DEBUG: print("DEBUG: sql_string:", sql_string)
try: