fix: provider proxy delay check (#7456)

* refactor(proxy): support delay testing for provider-based proxies

* style: remove debug console logs

* docs: update changelog

* feat(services): merge provider nodes into records in calcuProxies

---------

Co-authored-by: Tunglies <tunglies.dev@outlook.com>
This commit is contained in:
oomeow
2026-07-11 05:24:41 +00:00
committed by GitHub
co-authored by Tunglies
parent e8cefa8b07
commit 562828e14d
9 changed files with 73 additions and 87 deletions
+2 -19
View File
@@ -11,7 +11,7 @@ import {
useRef,
useState,
} from 'react'
import { delayGroup, healthcheckProxyProvider } from 'tauri-plugin-mihomo-api'
import { delayGroup } from 'tauri-plugin-mihomo-api'
import {
BaseEmpty,
@@ -97,29 +97,12 @@ function useProxyRenderState(
debugLog(`[ProxyGroups] 找到代理数量: ${proxies.length}`)
const providers = new Set(
proxies.map((p) => p!.provider!).filter(Boolean),
)
if (providers.size) {
debugLog(`[ProxyGroups] 发现提供者,数量: ${providers.size}`)
Promise.allSettled(
[...providers].map((p) => healthcheckProxyProvider(p)),
).then(() => {
debugLog(`[ProxyGroups] 提供者健康检查完成`)
onProxies()
})
}
const names = proxies.filter((p) => !p!.provider).map((p) => p!.name)
debugLog(`[ProxyGroups] 过滤后需要测试的代理数量: ${names.length}`)
const url = delayManager.getUrl(groupName)
debugLog(`[ProxyGroups] 测试URL: ${url}, 超时: ${timeout}ms`)
try {
await Promise.race([
delayManager.checkListDelay(names, groupName, timeout),
delayManager.checkListDelay(proxies, groupName, timeout),
delayGroup(groupName, url, timeout).then((result) => {
debugLog(
`[ProxyGroups] getGroupProxyDelays返回结果数量:`,