(socketId: string)
| 30 | * Removes the socket's operationIds from pending updates to prevent memory leaks. |
| 31 | */ |
| 32 | export function cleanupPendingSubblocksForSocket(socketId: string): void { |
| 33 | for (const [, pending] of pendingSubblockUpdates.entries()) { |
| 34 | // Remove this socket's operation entries |
| 35 | for (const [opId, sid] of pending.opToSocket.entries()) { |
| 36 | if (sid === socketId) { |
| 37 | pending.opToSocket.delete(opId) |
| 38 | } |
| 39 | } |
| 40 | // If no more operations are waiting, the timeout will still fire and flush |
| 41 | // This is fine - the update will still persist, just no confirmation to send |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | export function setupSubblocksHandlers(socket: AuthenticatedSocket, roomManager: IRoomManager) { |
| 46 | socket.on('subblock-update', async (data) => { |
no test coverage detected