mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
feat: increase the concurrency of latency test
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user