From c51b3248496c5eb29aa73237540bc03d135937d6 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Mon, 13 Apr 2026 14:26:21 +0800 Subject: [PATCH] Chore: increase download queue and enable HTTP/2 --- Build/lib/fetch-assets.ts | 3 ++- Build/lib/fetch-retry.ts | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Build/lib/fetch-assets.ts b/Build/lib/fetch-assets.ts index a7355d4e..4aa63540 100644 --- a/Build/lib/fetch-assets.ts +++ b/Build/lib/fetch-assets.ts @@ -12,7 +12,7 @@ import { AbortError } from 'foxts/abort-error'; const reusedCustomAbortError = new AbortError(); -const queue = newQueue(16); +const queue = newQueue(18); export async function fetchAssets( url: string, fallbackUrls: null | undefined | string[] | readonly string[], @@ -29,6 +29,7 @@ export async function fetchAssets( throw reusedCustomAbortError; } } + if (controller.signal.aborted) { throw reusedCustomAbortError; } diff --git a/Build/lib/fetch-retry.ts b/Build/lib/fetch-retry.ts index 33298e0d..7585fb1b 100644 --- a/Build/lib/fetch-retry.ts +++ b/Build/lib/fetch-retry.ts @@ -24,9 +24,11 @@ if (!fs.existsSync(CACHE_DIR)) { fs.mkdirSync(CACHE_DIR, { recursive: true }); } -const agent = new Agent({ allowH2: false }); +const agent = new Agent({ + allowH2: true +}); -(agent.compose( +agent.compose( interceptors.dns({ // disable IPv6 dualStack: false, @@ -126,7 +128,7 @@ const agent = new Agent({ allowH2: false }); }), cacheByDefault: 600 // 10 minutes }) -)); +); function calculateRetryAfterHeader(retryAfter: string) { const current = Date.now();