fix(all): 修复了一些bug

This commit is contained in:
2026-02-24 17:11:25 +08:00
parent 75b4341330
commit c2f041b03b
14 changed files with 816 additions and 191 deletions

View File

@@ -86,8 +86,10 @@ export interface TestResult {
export async function testAllNodes(
target: string,
onProgress: (result: LatencyResult) => void
onProgress: (result: LatencyResult) => void,
onPhase?: (phase: 'init' | 'testing' | 'traceroute') => void
): Promise<TestResult> {
onPhase?.('init')
for (const node of TEST_NODES) {
onProgress({ nodeId: node.id, latency: null, status: 'pending' })
}
@@ -107,6 +109,7 @@ export async function testAllNodes(
const { measurementId, tracerouteId }: BatchMeasurementResponse = await res.json()
onPhase?.('testing')
for (const node of TEST_NODES) {
onProgress({ nodeId: node.id, latency: null, status: 'testing' })
}
@@ -165,6 +168,7 @@ export async function testAllNodes(
// Fetch traceroute results if available
let traceroute: TracerouteStats | null = null
if (tracerouteId) {
onPhase?.('traceroute')
try {
const trRes = await fetch(`${API_BASE}/latency/traceroute/${tracerouteId}`)
if (trRes.ok) {