mirror of
https://ghfast.top/https://github.com/aeroxw/tick-stock-panel.git
synced 2026-09-12 16:44:15 +08:00
Merge pull request #273 from kevin9327/fix/test-endpoint-cold-cache
fix(settings): 端点清单缓存未预热时端点测速 500
This commit is contained in:
@@ -1666,7 +1666,9 @@ async def test_endpoint(req: TestEndpointIn) -> dict:
|
||||
import statistics
|
||||
|
||||
base = req.url.rstrip("/")
|
||||
rounds = max(1, min(10, req.rounds or _endpoints_cache.get("data", {}).get("testRounds", 5)))
|
||||
# 缓存初值的 "data" 是 None(键存在, get 的默认值不生效), 端点清单未预热时要兜底
|
||||
manifest = _endpoints_cache.get("data") or {}
|
||||
rounds = max(1, min(10, req.rounds or manifest.get("testRounds", 5)))
|
||||
health_url = base + "/health"
|
||||
|
||||
latencies: list[float] = []
|
||||
|
||||
Reference in New Issue
Block a user