fix(all): 修复了一些bug
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user