feat(backup): pre-migration snapshot gated on pending migrations; checkpoint WAL on shutdown

This commit is contained in:
Jannis Braun
2026-06-20 02:26:51 +02:00
parent 48bcd69031
commit 154feb2dd6
4 changed files with 79 additions and 3 deletions
+2 -1
View File
@@ -4,7 +4,7 @@ import rateLimit from '@fastify/rate-limit';
import websocket from '@fastify/websocket';
import fastifyStatic from '@fastify/static';
import { config } from './config.js';
import { getDb, getRawDb } from './db/index.js';
import { getDb, getRawDb, closeDatabase } from './db/index.js';
import { checkFfmpeg } from './utils/thumbnail.js';
import { authRoutes } from './routes/auth.js';
import { userRoutes } from './routes/users.js';
@@ -181,6 +181,7 @@ async function main(): Promise<void> {
console.log('Shutting down...');
stopFederationWorkers();
await app.close();
closeDatabase(); // checkpoints WAL — leaves a complete on-disk file
process.exit(0);
};