From 8917164aaca8fd42ca1d1dbc87d7c36de2486d1e Mon Sep 17 00:00:00 2001 From: MiyakoMeow <110924386+MiyakoMeow@users.noreply.github.com> Date: Mon, 3 Mar 2025 06:37:58 +0800 Subject: [PATCH] fix: add not available sign only --- fetch_ips.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fetch_ips.py b/fetch_ips.py index 714423575..e33b7d304 100644 --- a/fetch_ips.py +++ b/fetch_ips.py @@ -43,10 +43,6 @@ def select_ip_from_list(ip_list: List[str]) -> Optional[str]: ping_results = [(ip, ping_cached(ip)) for ip in ip_list] ping_results.sort(key=lambda x: x[1]) best_ip = ping_results[0][0] - # 全都超时?那就不选了 - if ping_results[0][1] == PING_TIMEOUT_SEC * 1000: - print(f"{ping_results}, no selection") - return None print(f"{ping_results}, selected {best_ip}") return best_ip @@ -142,7 +138,11 @@ async def main() -> None: if ip is None: print(f"{github_url}: IP Not Found") ip = "# Not available" - content += ip.ljust(30) + github_url + "\n" + content += ip.ljust(30) + github_url + global PING_LIST + if PING_LIST.get(ip) is not None and PING_LIST.get(ip) == PING_TIMEOUT_SEC * 1000: + content += " # Not Available" + content += "\n" content_list.append((ip, github_url,)) except Exception: continue