mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-10 05:15:35 +08:00
fix(config): speedtest timeout config
This commit is contained in:
parent
6c1f49480d
commit
5f1e77320d
@ -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',
|
||||
}
|
||||
|
@ -66,6 +66,6 @@ export default {
|
||||
lg: '超大尺寸',
|
||||
switchEndpoint: '切换后端',
|
||||
switchLanguage: '切换语言',
|
||||
requestTimeoutDuration: '请求超时时间',
|
||||
speedtestTimeoutDuration: '测速超时时间',
|
||||
closedConnections: '已关闭连接',
|
||||
}
|
||||
|
@ -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 = () => {
|
||||
|
||||
<div>
|
||||
<ConfigTitle>
|
||||
{t('requestTimeoutDuration')} ({t('ms')})
|
||||
{t('speedtestTimeoutDuration')} ({t('ms')})
|
||||
</ConfigTitle>
|
||||
|
||||
<input
|
||||
type="number"
|
||||
class="input input-bordered w-full max-w-md"
|
||||
value={requestTimeoutDuration()}
|
||||
onChange={(e) => setRequestTimeoutDuration(Number(e.target.value))}
|
||||
value={speedtestTimeoutDuration()}
|
||||
onChange={(e) => setSpeedtestTimeoutDuration(Number(e.target.value))}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
@ -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,
|
||||
})
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
|
||||
|
@ -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}` : '' },
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user