mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-18 14:30:29 +00:00
Reduce mirror timeouts and use fast mirror cache
Decreased default and test timeouts for mirrors to improve responsiveness. Updated logic in getAllGitHubTags and getWorkflowRunsFromHtml to use cached fast mirror lists instead of static lists for better performance.
This commit is contained in:
parent
8a232d8c68
commit
178e51bbb8
@ -133,7 +133,7 @@ const defaultConfig: MirrorConfig = {
|
|||||||
apiMirrors: GITHUB_API_MIRRORS,
|
apiMirrors: GITHUB_API_MIRRORS,
|
||||||
rawMirrors: GITHUB_RAW_MIRRORS,
|
rawMirrors: GITHUB_RAW_MIRRORS,
|
||||||
nightlyLinkMirrors: NIGHTLY_LINK_MIRRORS,
|
nightlyLinkMirrors: NIGHTLY_LINK_MIRRORS,
|
||||||
timeout: 10000, // 10秒超时,平衡速度和可靠性
|
timeout: 5000, // 5秒超时,平衡速度和可靠性
|
||||||
enabled: true,
|
enabled: true,
|
||||||
customMirror: undefined,
|
customMirror: undefined,
|
||||||
};
|
};
|
||||||
@ -257,7 +257,7 @@ export async function getFastMirrors (forceRefresh: boolean = false): Promise<st
|
|||||||
async function performMirrorTest (): Promise<string[]> {
|
async function performMirrorTest (): Promise<string[]> {
|
||||||
// 开始镜像测速
|
// 开始镜像测速
|
||||||
|
|
||||||
const timeout = 8000; // 测速超时 8 秒
|
const timeout = 3000; // 测速超时 3 秒
|
||||||
|
|
||||||
// 并行测试所有镜像
|
// 并行测试所有镜像
|
||||||
const mirrors = currentConfig.fileMirrors.filter(m => m);
|
const mirrors = currentConfig.fileMirrors.filter(m => m);
|
||||||
@ -821,8 +821,8 @@ export async function getAllGitHubTags (owner: string, repo: string, mirror?: st
|
|||||||
// 如果指定了镜像,只使用该镜像
|
// 如果指定了镜像,只使用该镜像
|
||||||
mirrors = [mirror];
|
mirrors = [mirror];
|
||||||
} else {
|
} else {
|
||||||
// 否则使用 auto 逻辑
|
// 否则使用 auto 逻辑,利用缓存的快速镜像列表
|
||||||
mirrors = ['', ...currentConfig.fileMirrors.filter(m => m)];
|
mirrors = await getFastMirrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 并行请求
|
// 并行请求
|
||||||
@ -907,7 +907,8 @@ async function getWorkflowRunsFromHtml (
|
|||||||
if (mirror) {
|
if (mirror) {
|
||||||
mirrors = [mirror];
|
mirrors = [mirror];
|
||||||
} else {
|
} else {
|
||||||
mirrors = ['', ...currentConfig.fileMirrors.filter(m => m)];
|
// 使用缓存的快速镜像列表
|
||||||
|
mirrors = await getFastMirrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const mirrorItem of mirrors) {
|
for (const mirrorItem of mirrors) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user