From efa3439e01d903be6bf6b9602298e14fe67c00ef Mon Sep 17 00:00:00 2001 From: Lekko Date: Thu, 2 Jul 2026 21:36:44 +0800 Subject: [PATCH] fix(update): increase npm registry fetch timeout from 5s to 15s (#1724) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The update checker fetches https://registry.npmjs.org/@larksuite/cli/latest with a 5-second HTTP client timeout. Under high-latency network conditions (TUN-mode proxies, VPNs, transcontinental routes), TLS handshake alone can take 4-6 seconds, causing the check to fail with: context deadline exceeded (Client.Timeout exceeded while awaiting headers) Measured example behind a Clash TUN proxy (US node from China): DNS resolve: ~0ms (fake-ip) TCP connect: ~0ms (local TUN) TLS handshake: 4.3-5.9s <-- bottleneck Total: 4.7-6.3s curl succeeds because it has no default connect timeout, but the Go HTTP client with Timeout=5s is too tight. The registry endpoint returns a tiny JSON payload (<1KB), so 15s is more than enough headroom while still failing fast on genuinely unreachable networks. Co-authored-by: 王伟达 --- internal/update/update.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/update/update.go b/internal/update/update.go index 31fef085e..7bdc61d9c 100644 --- a/internal/update/update.go +++ b/internal/update/update.go @@ -25,7 +25,7 @@ import ( const ( registryURL = "https://registry.npmjs.org/@larksuite/cli/latest" cacheTTL = 24 * time.Hour - fetchTimeout = 5 * time.Second + fetchTimeout = 15 * time.Second stateFile = "update-state.json" maxBody = 256 << 10 // 256 KB