fix: CardAuth心跳超时8s→15s+重试一次(FRP冷启动偶发超时)
Publish Docker image to GHCR / build-push (push) Canceled after 0s

This commit is contained in:
personal827 committed 2026-10-27 15:07:18 +08:00
1 parent fe87875866
commit 9b7effa405
1 file changed
+8 -5
+8 -5
View File
@@ -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;
}