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:
parent
5f7cd4c8bc
commit
7e4e739e8d
@ -1001,7 +1001,7 @@ class RPCClient {
|
||||
}
|
||||
|
||||
// VPN
|
||||
async vpnStatus(): Promise<{
|
||||
async vpnStatus(signal?: AbortSignal): Promise<{
|
||||
connected: boolean
|
||||
provider?: string
|
||||
interface?: string
|
||||
@ -1021,6 +1021,7 @@ class RPCClient {
|
||||
return this.call({
|
||||
method: 'vpn.status',
|
||||
params: {},
|
||||
signal,
|
||||
dedup: true, // read-only status; safe to collapse concurrent callers (PERF-02)
|
||||
})
|
||||
}
|
||||
@ -1082,7 +1083,7 @@ class RPCClient {
|
||||
}
|
||||
|
||||
// DNS
|
||||
async dnsStatus(): Promise<{
|
||||
async dnsStatus(signal?: AbortSignal): Promise<{
|
||||
provider: string
|
||||
servers: string[]
|
||||
doh_enabled: boolean
|
||||
@ -1092,6 +1093,7 @@ class RPCClient {
|
||||
return this.call({
|
||||
method: 'network.dns-status',
|
||||
params: {},
|
||||
signal,
|
||||
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([
|
||||
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.vpnStatus(),
|
||||
rpcClient.dnsStatus(),
|
||||
rpcClient.vpnStatus(signal),
|
||||
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 (fwdRes.status === 'fulfilled') { const c = fwdRes.value.forwards?.length ?? 0; next.forwardCount = `${c} rule${c !== 1 ? 's' : ''}` }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user