feat: 按账号调度自动学习并让首页实时跟上状态

This commit is contained in:
2026-11-16 01:14:36 +08:00
parent 158578d17c
commit 7f0466b0f6
31 changed files with 2699 additions and 631 deletions
+4 -4
View File
@@ -196,7 +196,7 @@ def test_probe_averages_euniv_related_sites(monkeypatch) -> None:
status_code = 200
class FakeClient:
def __init__(self, **_kwargs) -> None:
def __init__(self, *_args, **_kwargs) -> None:
return None
def __enter__(self):
@@ -210,7 +210,7 @@ def test_probe_averages_euniv_related_sites(monkeypatch) -> None:
return FakeResponse()
ticks = iter([0.0, 0.12, 0.12, 0.34, 0.34, 0.64])
monkeypatch.setattr("euniv.proxy_pool.httpx.Client", FakeClient)
monkeypatch.setattr("euniv.proxy_pool.sync_httpx_client", FakeClient)
monkeypatch.setattr("euniv.proxy_pool.time.perf_counter", lambda: next(ticks))
ok, latency, reason = probe("http", "10.0.0.9", 8080)
assert seen == list(PROBE_URLS)
@@ -221,7 +221,7 @@ def test_probe_averages_euniv_related_sites(monkeypatch) -> None:
def test_probe_instant_connect_error_keeps_elapsed_latency(monkeypatch) -> None:
class FakeClient:
def __init__(self, **_kwargs) -> None:
def __init__(self, *_args, **_kwargs) -> None:
return None
def __enter__(self):
@@ -234,7 +234,7 @@ def test_probe_instant_connect_error_keeps_elapsed_latency(monkeypatch) -> None:
raise httpx.ConnectError("boom")
ticks = iter([0.0, 0.012, 0.012, 0.018, 0.018, 0.025])
monkeypatch.setattr("euniv.proxy_pool.httpx.Client", FakeClient)
monkeypatch.setattr("euniv.proxy_pool.sync_httpx_client", FakeClient)
monkeypatch.setattr("euniv.proxy_pool.time.perf_counter", lambda: next(ticks))
ok, latency, reason = probe("socks4", "10.0.0.9", 1080)
assert ok is False