diff --git a/src/i18n/en.ts b/src/i18n/en.ts
index 5516871..fe38ca8 100644
--- a/src/i18n/en.ts
+++ b/src/i18n/en.ts
@@ -66,6 +66,6 @@ export default {
lg: 'Large size',
switchEndpoint: 'Switch Endpoint',
switchLanguage: 'Switch Language',
- requestTimeoutDuration: 'Request Timeout Duration',
+ speedtestTimeoutDuration: 'Speedtest Timeout Duration',
closedConnections: 'Closed Connections',
}
diff --git a/src/i18n/zh.ts b/src/i18n/zh.ts
index dd7670a..dc22a93 100644
--- a/src/i18n/zh.ts
+++ b/src/i18n/zh.ts
@@ -66,6 +66,6 @@ export default {
lg: '超大尺寸',
switchEndpoint: '切换后端',
switchLanguage: '切换语言',
- requestTimeoutDuration: '请求超时时间',
+ speedtestTimeoutDuration: '测速超时时间',
closedConnections: '已关闭连接',
}
diff --git a/src/pages/Config.tsx b/src/pages/Config.tsx
index 6dfb2af..0aa6d28 100644
--- a/src/pages/Config.tsx
+++ b/src/pages/Config.tsx
@@ -30,7 +30,6 @@ import {
proxiesPreviewType,
renderInTwoColumn,
renderProxiesInSamePage,
- requestTimeoutDuration,
setAutoCloseConns,
setAutoSwitchTheme,
setFavDayTheme,
@@ -39,11 +38,12 @@ import {
setProxiesPreviewType,
setRenderInTwoColumn,
setRenderProxiesInSamePage,
- setRequestTimeoutDuration,
setSelectedEndpoint,
+ setSpeedtestTimeoutDuration,
setTableSize,
setTwemoji,
setUrlForLatencyTest,
+ speedtestTimeoutDuration,
tableSize,
urlForLatencyTest,
useRequest,
@@ -234,14 +234,14 @@ const ConfigForm = () => {
- {t('requestTimeoutDuration')} ({t('ms')})
+ {t('speedtestTimeoutDuration')} ({t('ms')})
setRequestTimeoutDuration(Number(e.target.value))}
+ value={speedtestTimeoutDuration()}
+ onChange={(e) => setSpeedtestTimeoutDuration(Number(e.target.value))}
/>
diff --git a/src/signals/config.ts b/src/signals/config.ts
index f4d4a42..42e3554 100644
--- a/src/signals/config.ts
+++ b/src/signals/config.ts
@@ -76,9 +76,9 @@ export const tableSizeClassName = (size: TAILWINDCSS_SIZE) => {
return className
}
-export const [requestTimeoutDuration, setRequestTimeoutDuration] =
- makePersisted(createSignal(10000), {
- name: 'requestTimeoutDuration',
+export const [speedtestTimeoutDuration, setSpeedtestTimeoutDuration] =
+ makePersisted(createSignal(2000), {
+ name: 'speedtestTimeoutDuration',
storage: localStorage,
})
diff --git a/src/signals/proxies.ts b/src/signals/proxies.ts
index 4685987..858e86d 100644
--- a/src/signals/proxies.ts
+++ b/src/signals/proxies.ts
@@ -1,5 +1,10 @@
import { createSignal } from 'solid-js'
-import { autoCloseConns, urlForLatencyTest, useRequest } from '~/signals'
+import {
+ autoCloseConns,
+ speedtestTimeoutDuration,
+ urlForLatencyTest,
+ useRequest,
+} from '~/signals'
import type { Proxy, ProxyNode, ProxyProvider } from '~/types'
type ProxyInfo = {
@@ -93,7 +98,7 @@ export const useProxies = () => {
.get(`group/${proxyGroupName}/delay`, {
searchParams: {
url: urlForLatencyTest(),
- timeout: 2000,
+ timeout: speedtestTimeoutDuration(),
},
})
.json()
@@ -121,7 +126,9 @@ export const useProxies = () => {
}
const healthCheckByProviderName = async (providerName: string) => {
- await request.get(`providers/proxies/${providerName}/healthcheck`)
+ await request.get(`providers/proxies/${providerName}/healthcheck`, {
+ timeout: 20 * 1000,
+ })
await updateProxies()
}
diff --git a/src/signals/request.ts b/src/signals/request.ts
index 1905129..e3b74b9 100644
--- a/src/signals/request.ts
+++ b/src/signals/request.ts
@@ -1,7 +1,6 @@
import { makePersisted } from '@solid-primitives/storage'
import ky from 'ky'
import { createSignal } from 'solid-js'
-import { requestTimeoutDuration } from '~/signals/config'
export const [selectedEndpoint, setSelectedEndpoint] = makePersisted(
createSignal(''),
@@ -27,7 +26,6 @@ export const useRequest = () => {
return ky.create({
prefixUrl: e?.url,
- timeout: requestTimeoutDuration(),
headers: { Authorization: e?.secret ? `Bearer ${e.secret}` : '' },
})
}