From 9b7effa40565fb8fe4fba4b94a42e6735df5c058 Mon Sep 17 00:00:00 2001 From: personal827 Date: Tue, 27 Oct 2026 15:07:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20CardAuth=E5=BF=83=E8=B7=B3=E8=B6=85?= =?UTF-8?q?=E6=97=B68s=E2=86=9215s+=E9=87=8D=E8=AF=95=E4=B8=80=E6=AC=A1(FR?= =?UTF-8?q?P=E5=86=B7=E5=90=AF=E5=8A=A8=E5=81=B6=E5=8F=91=E8=B6=85?= =?UTF-8?q?=E6=97=B6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server.js b/server.js index 9587c0a..c84df90 100644 --- a/server.js +++ b/server.js @@ -243,7 +243,7 @@ const AUTH = (() => { const opts = { method: m, hostname: u.hostname, port: u.port || (u.protocol === 'https:' ? 443 : 80), path: u.pathname + u.search, headers: { 'Content-Type': 'application/json', Accept: 'application/json', ...(c.apiKey ? { 'X-Api-Key': c.apiKey } : {}) }, - timeout: 8000 }; + timeout: 15000 }; const rq = mod.request(opts, rs => { let b = ''; rs.on('data', d2 => b += d2); @@ -260,10 +260,13 @@ const AUTH = (() => { async function heartbeat() { const c = cfg(); if (!c.apiKey || !c.projectId) return null; - const r = await request('POST', '/public/installations/check-update', { - project_id: c.projectId, machine_id: machineId(), - client_version: c.version, device_info: 'Docker ' + (process.env.HOSTNAME || 'container') - }); + const body = { project_id: c.projectId, machine_id: machineId(), + client_version: c.version, device_info: 'Docker ' + (process.env.HOSTNAME || 'container') }; + let r = await request('POST', '/public/installations/check-update', body); + if (!r) { // FRP 隧道冷启动偶发超时,重试一次 + await new Promise(x => setTimeout(x, 2500)); + r = await request('POST', '/public/installations/check-update', body); + } if (r && r.code === 200 && r.data) { meta = r.data; metaAt = Date.now(); } return (r && r.code === 200) ? r.data : null; }