From: Roland Häder Date: Sun, 23 Jul 2023 17:30:13 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=81e77a5e04daf2cd7f7a2474f0830d874c04dfd5;p=fba.git Continued: - better check if no peers has further been added --- diff --git a/fba/networks/misskey.py b/fba/networks/misskey.py index ec35833..c254111 100644 --- a/fba/networks/misskey.py +++ b/fba/networks/misskey.py @@ -86,7 +86,7 @@ def fetch_peers(domain: str) -> list: rows = fetched["json"] - logger.debug("rows(%d)[]='%s'", len(rows), type(rows)) + logger.debug("rows(%d)[]='%s',step=%d", len(rows), type(rows), step) if len(rows) == 0: logger.debug("Returned zero bytes, domain='%s' - BREAK!", domain) break @@ -97,7 +97,7 @@ def fetch_peers(domain: str) -> list: logger.debug("Raising offset by step=%d", step) offset = offset + step - already = 0 + added = 0 logger.debug("rows(%d))[]='%s'", len(rows), type(rows)) for row in rows: logger.debug("row()=%d", len(row)) @@ -112,14 +112,15 @@ def fetch_peers(domain: str) -> list: continue elif row["host"] in peers: logger.debug("Not adding row[host]='%s', already found - SKIPPED!", row['host']) - already = already + 1 continue logger.debug("Adding peer: row[host]='%s'", row['host']) + added = added + 1 peers.append(row["host"]) - if already == len(rows): - logger.debug("Host returned same set of %d instance(s) - BREAK!", already) + logger.debug("added=%d,rows()=%d", added, len(rows)) + if added == 0: + logger.debug("Host returned already added (%d) peers - BREAK!", len(rows)) break logger.debug("peers()=%d - EXIT!", len(peers))