This commit is contained in:
Bojan Kucera 2025-06-08 14:36:23 -04:00
parent 8daaff27fd
commit 811fc86c92
3 changed files with 78 additions and 138 deletions

View file

@ -122,15 +122,13 @@ async function initializeServices() {
logger.info('Initializing data service...');
try {
// Queue manager is initialized automatically when imported
logger.info('Queue manager initialized');
// Initialize providers
// Initialize queue service
await queueManager.initialize();
logger.info('Queue service initialized');
logger.info('All services initialized successfully');
} catch (error) {
logger.error('Failed to initialize services', { error });
process.exit(1);
throw error;
}
}
@ -155,6 +153,19 @@ async function startServer() {
logger.info(' GET /api/providers - List registered providers');
}
// Graceful shutdown
process.on('SIGINT', async () => {
logger.info('Received SIGINT, shutting down gracefully...');
await queueManager.shutdown();
process.exit(0);
});
process.on('SIGTERM', async () => {
logger.info('Received SIGTERM, shutting down gracefully...');
await queueManager.shutdown();
process.exit(0);
});
startServer().catch(error => {
logger.error('Failed to start server', { error });
process.exit(1);