From 9189bf5efb0676a053981e0ffd3b3c21f8332dcf Mon Sep 17 00:00:00 2001 From: YetAnotherZephyruso <176294927+YetAnotherZephyruso@users.noreply.github.com> Date: Mon, 26 Aug 2024 16:24:40 +0800 Subject: [PATCH] fix: set latency for test failed (#948) --- src/signals/proxies.ts | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/signals/proxies.ts b/src/signals/proxies.ts index ea85c93..0e15ff5 100644 --- a/src/signals/proxies.ts +++ b/src/signals/proxies.ts @@ -184,17 +184,24 @@ export const useProxies = () => { setProxyLatencyTestingMap(nodeName, async () => { await proxyIPv6SupportTest(nodeName, provider) - const { delay } = await proxyLatencyTestAPI( - nodeName, - provider, - urlForLatencyTest(), - latencyTestTimeoutDuration(), - ) + try { + const { delay } = await proxyLatencyTestAPI( + nodeName, + provider, + urlForLatencyTest(), + latencyTestTimeoutDuration(), + ) - setLatencyMap((latencyMap) => ({ - ...latencyMap, - [nodeName]: delay, - })) + setLatencyMap((latencyMap) => ({ + ...latencyMap, + [nodeName]: delay, + })) + } catch { + setLatencyMap((latencyMap) => ({ + ...latencyMap, + [nodeName]: latencyQualityMap().NOT_CONNECTED, + })) + } }) }