perf: reduce SSH connection timeout from 5s to 2s for server metrics
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 41s

- Remote metrics SSH ConnectTimeout: 5s → 2s
- Remote metrics SSH command timeout: 8s → 4s
- Health check SSH timeouts remain at 3s (already reasonable)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
WangDL 2026-05-24 19:57:55 +08:00
parent f599af1b3c
commit 2c164f46da

View File

@ -104,7 +104,7 @@ export class AdminServersService {
async getRemoteMetrics(): Promise<ServerInfo | null> {
const run = (cmd: string) =>
execAsync(`ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 -i ${SSH_KEY_PATH} ubuntu@${REMOTE_HOST} '${cmd.replace(/'/g, "'\\''")}'`, { timeout: 8000 })
execAsync(`ssh -o StrictHostKeyChecking=no -o ConnectTimeout=2 -i ${SSH_KEY_PATH} ubuntu@${REMOTE_HOST} '${cmd.replace(/'/g, "'\\''")}'`, { timeout: 4000 })
.then(r => r.stdout.trim()).catch(() => '');
try {