fix(02-review): WR-05 forward abort signal through vpnStatus()/dnsStatus()
server.network-summary's fetcher batches four RPCs but only two forwarded the AbortSignal useCachedResource provides for abort-on-unmount; rpcClient.vpnStatus()/dnsStatus() had no signal parameter at all, so aborter.abort() couldn't cancel them, partially defeating the documented abort-on-unmount contract for this resource. Add an optional signal parameter to both convenience methods (mirroring the pattern used throughout rpc-client.ts) and forward it from Server.vue. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1001,7 +1001,7 @@ class RPCClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// VPN
|
// VPN
|
||||||
async vpnStatus(): Promise<{
|
async vpnStatus(signal?: AbortSignal): Promise<{
|
||||||
connected: boolean
|
connected: boolean
|
||||||
provider?: string
|
provider?: string
|
||||||
interface?: string
|
interface?: string
|
||||||
@@ -1021,6 +1021,7 @@ class RPCClient {
|
|||||||
return this.call({
|
return this.call({
|
||||||
method: 'vpn.status',
|
method: 'vpn.status',
|
||||||
params: {},
|
params: {},
|
||||||
|
signal,
|
||||||
dedup: true, // read-only status; safe to collapse concurrent callers (PERF-02)
|
dedup: true, // read-only status; safe to collapse concurrent callers (PERF-02)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1082,7 +1083,7 @@ class RPCClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DNS
|
// DNS
|
||||||
async dnsStatus(): Promise<{
|
async dnsStatus(signal?: AbortSignal): Promise<{
|
||||||
provider: string
|
provider: string
|
||||||
servers: string[]
|
servers: string[]
|
||||||
doh_enabled: boolean
|
doh_enabled: boolean
|
||||||
@@ -1092,6 +1093,7 @@ class RPCClient {
|
|||||||
return this.call({
|
return this.call({
|
||||||
method: 'network.dns-status',
|
method: 'network.dns-status',
|
||||||
params: {},
|
params: {},
|
||||||
|
signal,
|
||||||
dedup: true, // read-only status; safe to collapse concurrent callers (PERF-02)
|
dedup: true, // read-only status; safe to collapse concurrent callers (PERF-02)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -477,8 +477,8 @@ const networkRes: CachedResource<NetworkData> = useCachedResource<NetworkData>({
|
|||||||
const [diagRes, fwdRes, vpnRes, dnsRes] = await Promise.allSettled([
|
const [diagRes, fwdRes, vpnRes, dnsRes] = await Promise.allSettled([
|
||||||
rpcClient.call<{ wan_ip: string | null; nat_type: string; upnp_available: boolean; tor_connected: boolean; wifi_count?: number }>({ method: 'network.diagnostics', signal, dedup: true, maxRetries: 1 }),
|
rpcClient.call<{ wan_ip: string | null; nat_type: string; upnp_available: boolean; tor_connected: boolean; wifi_count?: number }>({ method: 'network.diagnostics', signal, dedup: true, maxRetries: 1 }),
|
||||||
rpcClient.call<{ forwards: unknown[] }>({ method: 'router.list-forwards', signal, dedup: true, maxRetries: 1 }),
|
rpcClient.call<{ forwards: unknown[] }>({ method: 'router.list-forwards', signal, dedup: true, maxRetries: 1 }),
|
||||||
rpcClient.vpnStatus(),
|
rpcClient.vpnStatus(signal),
|
||||||
rpcClient.dnsStatus(),
|
rpcClient.dnsStatus(signal),
|
||||||
])
|
])
|
||||||
if (diagRes.status === 'fulfilled') { next.torConnected = diagRes.value.tor_connected; next.wifiCount = diagRes.value.wifi_count !== undefined ? `${diagRes.value.wifi_count} configured` : 'N/A'; next.wifiSsid = (diagRes.value as { wifi_ssid?: string | null }).wifi_ssid ?? null }
|
if (diagRes.status === 'fulfilled') { next.torConnected = diagRes.value.tor_connected; next.wifiCount = diagRes.value.wifi_count !== undefined ? `${diagRes.value.wifi_count} configured` : 'N/A'; next.wifiSsid = (diagRes.value as { wifi_ssid?: string | null }).wifi_ssid ?? null }
|
||||||
if (fwdRes.status === 'fulfilled') { const c = fwdRes.value.forwards?.length ?? 0; next.forwardCount = `${c} rule${c !== 1 ? 's' : ''}` }
|
if (fwdRes.status === 'fulfilled') { const c = fwdRes.value.forwards?.length ?? 0; next.forwardCount = `${c} rule${c !== 1 ? 's' : ''}` }
|
||||||
|
|||||||
Reference in New Issue
Block a user