Fix unhandled promise rejections in LoggingService and WebSocketService - prevent crashes from async operations in constructors
This commit is contained in:
@@ -110,8 +110,10 @@ export class WebSocketService {
|
||||
this.maxMessagesPerUser = parseInt(process.env.CHAT_MAX_MESSAGES_PER_USER || '100');
|
||||
this.messageCleanupWeeks = parseInt(process.env.CHAT_MESSAGE_CLEANUP_WEEKS || '4');
|
||||
|
||||
// Initialize Redis connection
|
||||
this.initializeRedis();
|
||||
// Initialize Redis connection (handle async without await in constructor)
|
||||
this.initializeRedis().catch(error => {
|
||||
logError('Redis initialization failed in WebSocketService constructor', error as Error);
|
||||
});
|
||||
|
||||
this.setupSocketHandlers();
|
||||
this.setupArchivingScheduler();
|
||||
|
||||
Reference in New Issue
Block a user