From 82b042209ef927a6b737a886b099ad5bb2c05ef1 Mon Sep 17 00:00:00 2001 From: claude code agent 227 Date: Mon, 29 Jun 2026 04:32:34 +0300 Subject: [PATCH] fix(ws): make redis adapter error handlers actually log (were noop) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pub/sub error handlers were `(err) => () => {}` — a noop returning an inner arrow that never runs, so socket.io redis client errors were silently swallowed. Log them via Nest Logger. Adjacent pre-existing bug surfaced in review of #255. Co-Authored-By: Claude Opus 4.8 (1M context) --- apps/server/src/ws/adapter/ws-redis.adapter.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/server/src/ws/adapter/ws-redis.adapter.ts b/apps/server/src/ws/adapter/ws-redis.adapter.ts index b72e35e2..4cc1c3e5 100644 --- a/apps/server/src/ws/adapter/ws-redis.adapter.ts +++ b/apps/server/src/ws/adapter/ws-redis.adapter.ts @@ -1,3 +1,4 @@ +import { Logger } from '@nestjs/common'; import { IoAdapter } from '@nestjs/platform-socket.io'; import { ServerOptions } from 'socket.io'; import { createAdapter } from '@socket.io/redis-adapter'; @@ -9,6 +10,7 @@ import { } from '../../common/helpers'; export class WsRedisIoAdapter extends IoAdapter { + private readonly logger = new Logger(WsRedisIoAdapter.name); private adapterConstructor: ReturnType; private redisConfig: RedisConfig; private pubClient: Redis; @@ -25,8 +27,8 @@ export class WsRedisIoAdapter extends IoAdapter { const pubClient = new Redis(process.env.REDIS_URL, options); const subClient = new Redis(process.env.REDIS_URL, options); - pubClient.on('error', (err) => () => {}); - subClient.on('error', (err) => () => {}); + pubClient.on('error', (err) => this.logger.error('socket.io redis pub client error', err)); + subClient.on('error', (err) => this.logger.error('socket.io redis sub client error', err)); // Hold references so the pub/sub connections can be torn down on shutdown // (see dispose()); otherwise these ioredis sockets leak as active handles.