fix: backup blockiert HTTP-Response nicht mehr

setImmediate() startet Backup außerhalb des Next.js Request-Kontexts,
ConnectTimeout=15 verhindert hängende SSH-Verbindungen.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 14:06:17 +02:00
parent 2e875ed1ad
commit fb0b64c36c
+2 -1
View File
@@ -1,7 +1,7 @@
import { spawn } from 'child_process';
export function triggerBackup(): void {
runBackup().catch((e) => console.error('[backup] Fehler:', e));
setImmediate(() => runBackup().catch((e) => console.error('[backup] Fehler:', e)));
}
async function runBackup(): Promise<void> {
@@ -32,6 +32,7 @@ async function runBackup(): Promise<void> {
...(keyPath ? ['-i', keyPath] : []),
'-o', 'StrictHostKeyChecking=no',
'-o', 'BatchMode=yes',
'-o', 'ConnectTimeout=15',
];
const dumpBin = process.env.BACKUP_DUMP_CMD || 'mariadb-dump';