feat: increase the concurrency of latency test

This commit is contained in:
GyDi
2023-11-01 20:52:38 +08:00
parent 1f1e743912
commit 5a0fed9c93
6 changed files with 45 additions and 4 deletions

View File

@@ -65,7 +65,7 @@ export const getRules = async () => {
/// Get Proxy delay
export const getProxyDelay = async (name: string, url?: string) => {
const params = {
timeout: 5000,
timeout: 10000,
url: url || "http://www.gstatic.com/generate_204",
};
const instance = await getAxios();

View File

@@ -153,6 +153,11 @@ export async function openWebUrl(url: string) {
return invoke<void>("open_web_url", { url });
}
export async function cmdGetProxyDelay(name: string, url?: string) {
name = encodeURIComponent(name);
return invoke<{ delay: number }>("clash_api_get_proxy_delay", { name, url });
}
/// service mode
export async function checkService() {

View File

@@ -1,4 +1,4 @@
import { getProxyDelay } from "./api";
import { cmdGetProxyDelay } from "./cmds";
const hashKey = (name: string, group: string) => `${group ?? ""}::${name}`;
@@ -74,7 +74,7 @@ class DelayManager {
try {
const url = this.getUrl(group);
const result = await getProxyDelay(name, url);
const result = await cmdGetProxyDelay(name, url);
delay = result.delay;
} catch {
delay = 1e6; // error
@@ -84,7 +84,7 @@ class DelayManager {
return delay;
}
async checkListDelay(nameList: string[], group: string, concurrency = 6) {
async checkListDelay(nameList: string[], group: string, concurrency = 36) {
const names = nameList.filter(Boolean);
// 设置正在延迟测试中
names.forEach((name) => this.setDelay(name, group, -2));