* 智能选择最佳可用服务器 - 简化版本
()
| 922 | * 智能选择最佳可用服务器 - 简化版本 |
| 923 | */ |
| 924 | async function selectBestServer(): Promise<number | null> { |
| 925 | try { |
| 926 | const allServers = await getAllServers(); |
| 927 | if (allServers.length === 0) { |
| 928 | return null; |
| 929 | } |
| 930 | |
| 931 | // 直接返回第一个服务器,因为服务器列表通常按距离排序 |
| 932 | // 这避免了复杂的ping测试,提高成功率 |
| 933 | return allServers[0].id; |
| 934 | } catch (error) { |
| 935 | console.error('Failed to select best server:', error); |
| 936 | return null; |
| 937 | } |
| 938 | } |
| 939 | |
| 940 | /** |
| 941 | * 备用:选择多个候选服务器进行测试 |
nothing calls this directly
no test coverage detected