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:
+2
-1
@@ -1,7 +1,7 @@
|
|||||||
import { spawn } from 'child_process';
|
import { spawn } from 'child_process';
|
||||||
|
|
||||||
export function triggerBackup(): void {
|
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> {
|
async function runBackup(): Promise<void> {
|
||||||
@@ -32,6 +32,7 @@ async function runBackup(): Promise<void> {
|
|||||||
...(keyPath ? ['-i', keyPath] : []),
|
...(keyPath ? ['-i', keyPath] : []),
|
||||||
'-o', 'StrictHostKeyChecking=no',
|
'-o', 'StrictHostKeyChecking=no',
|
||||||
'-o', 'BatchMode=yes',
|
'-o', 'BatchMode=yes',
|
||||||
|
'-o', 'ConnectTimeout=15',
|
||||||
];
|
];
|
||||||
|
|
||||||
const dumpBin = process.env.BACKUP_DUMP_CMD || 'mariadb-dump';
|
const dumpBin = process.env.BACKUP_DUMP_CMD || 'mariadb-dump';
|
||||||
|
|||||||
Reference in New Issue
Block a user