This commit is contained in:
seb
2026-10-08 03:43:28 +02:00
parent c543c76a21
commit 717f4754d4
9 changed files with 787 additions and 24 deletions

View File

@@ -1,13 +1,16 @@
import './config/env.js';
import { startApi, stopApi } from './api/index.js';
import { closeStore } from './db/store.js';
import { createLogger } from './util/logger.js';
const sysLog = createLogger('system');
async function shutdown() {
await stopApi();
try {
await closeStore();
} catch (error) {
console.error('Failed to close database:', error);
sysLog.error('Failed to close database:', error);
process.exitCode = 1;
}
}
@@ -20,6 +23,6 @@ process.on('SIGTERM', () => {
});
startApi().catch((err) => {
console.error('Failed to start API:', err.message);
sysLog.error('Failed to start API:', err.message);
process.exit(1);
});