Remove unnecessary shutdown handlers

Daemon runs forever; launchd manages lifecycle. SQLite handles
ungraceful shutdowns fine.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gavrielc
2026-01-31 19:21:59 +02:00
parent 0691601469
commit 545cbc7b9c
2 changed files with 1 additions and 13 deletions

View File

@@ -32,10 +32,6 @@ export function initDatabase(): void {
`); `);
} }
export function closeDatabase(): void {
db.close();
}
export function storeMessage(msg: proto.IWebMessageInfo, chatJid: string, isFromMe: boolean): void { export function storeMessage(msg: proto.IWebMessageInfo, chatJid: string, isFromMe: boolean): void {
if (!msg.key) return; if (!msg.key) return;

View File

@@ -20,7 +20,7 @@ import {
CLEAR_COMMAND CLEAR_COMMAND
} from './config.js'; } from './config.js';
import { RegisteredGroup, Session, NewMessage } from './types.js'; import { RegisteredGroup, Session, NewMessage } from './types.js';
import { initDatabase, closeDatabase, storeMessage, getNewMessages } from './db.js'; import { initDatabase, storeMessage, getNewMessages } from './db.js';
const logger = pino({ const logger = pino({
level: process.env.LOG_LEVEL || 'info', level: process.env.LOG_LEVEL || 'info',
@@ -232,14 +232,6 @@ async function main(): Promise<void> {
logger.info('Database initialized'); logger.info('Database initialized');
loadState(); loadState();
await connectWhatsApp(); await connectWhatsApp();
const shutdown = () => {
logger.info('Shutting down...');
closeDatabase();
process.exit(0);
};
process.on('SIGINT', shutdown);
process.on('SIGTERM', shutdown);
} }
main().catch(err => { main().catch(err => {