diff --git a/app/durableObjects/ChatRoom.server.ts b/app/durableObjects/ChatRoom.server.ts index b1e1fa42..9fa42472 100644 --- a/app/durableObjects/ChatRoom.server.ts +++ b/app/durableObjects/ChatRoom.server.ts @@ -314,9 +314,13 @@ export class ChatRoom extends Server { } onError(connection: Connection, error: unknown): void | Promise { + log({ + eventName: 'onErrorHandler', + error, + }) return this.getMeetingId().then((meetingId) => { log({ - eventName: 'onErrorHandler', + eventName: 'onErrorHandlerDetails', meetingId, connectionId: connection.id, error, @@ -348,7 +352,15 @@ export class ChatRoom extends Server { async cleanupOldConnections() { const meetingId = await this.getMeetingId() if (!meetingId) log({ eventName: 'meetingIdNotFoundInCleanup' }) + const websockets = this.ctx.getWebSockets() const connections = [...this.getConnections()] + log({ + eventName: 'cleaningUpConnections', + meetingId, + connectionsFound: connections.length, + websocketsFound: websockets.length, + websocketStatuses: websockets.map((w) => w.readyState), + }) const sessionsToCleanUp = await this.getUsers() connections.forEach((connection) => diff --git a/app/utils/logging.ts b/app/utils/logging.ts index c11094cc..cbddf06a 100644 --- a/app/utils/logging.ts +++ b/app/utils/logging.ts @@ -18,6 +18,13 @@ export type LogEvent = meetingId?: string connectionId: string } + | { + eventName: 'cleaningUpConnections' + meetingId?: string + connectionsFound: number + websocketsFound: number + websocketStatuses: number[] + } | { eventName: 'userTimedOut' meetingId?: string @@ -41,6 +48,10 @@ export type LogEvent = } | { eventName: 'onErrorHandler' + error: unknown + } + | { + eventName: 'onErrorHandlerDetails' meetingId?: string connectionId: string error: unknown