Promise.race 调整为 Promise.any 确保返回 健康的地址
| | |
| | | healthPath: "/Health", |
| | | }, |
| | | { |
| | | name: "API_INNER", |
| | | name: "API_OUTER", |
| | | baseUrl: process.env.VUE_APP_BASE_API, // 外网地址 |
| | | healthPath: "/Health", |
| | | }, |
| | |
| | | const healthCheckPromises = serviceList.map((item) => { |
| | | return checkServiceHealth(item) |
| | | }); |
| | | const healthResult = await Promise.race(healthCheckPromises); // 竞速模式,检测到健康的链接就立刻返回 |
| | | // 筛选可用的 baseUrl(取第一个有效地址) |
| | | const healthResult = await Promise.any(healthCheckPromises); // 检测到健康的链接就立刻返回 |
| | | // 筛选可用的 baseUrl |
| | | const availableBaseUrl = healthResult |
| | | |
| | | if (availableBaseUrl) { |