diff --git a/src/common/adapters/socket.adapter.ts b/src/common/adapters/socket.adapter.ts index afd2180f..f2ef8a6d 100644 --- a/src/common/adapters/socket.adapter.ts +++ b/src/common/adapters/socket.adapter.ts @@ -12,7 +12,7 @@ export class RedisIoAdapter extends IoAdapter { const redisAdapter = createAdapter(pubClient, subClient, { key: RedisIoAdapterKey, - requestsTimeout: 3000, + requestsTimeout: 10000, }) server.adapter(redisAdapter) return server diff --git a/src/common/filters/any-exception.filter.ts b/src/common/filters/any-exception.filter.ts index c3480607..286cb7ac 100644 --- a/src/common/filters/any-exception.filter.ts +++ b/src/common/filters/any-exception.filter.ts @@ -52,13 +52,13 @@ export class AllExceptionsFilter implements ExceptionFilter { process.on('unhandledRejection', (reason: any) => { console.error('unhandledRejection: ', reason) - this.eventManager.broadcast( - EventBusEvents.SystemException, - { message: reason?.message ?? reason, stack: reason?.stack || '' }, - { - scope: EventScope.TO_SYSTEM, - }, - ) + // this.eventManager.broadcast( + // EventBusEvents.SystemException, + // { message: reason?.message ?? reason, stack: reason?.stack || '' }, + // { + // scope: EventScope.TO_SYSTEM, + // }, + // ) }) process.on('uncaughtException', (err) => { diff --git a/src/processors/gateway/web/events.gateway.ts b/src/processors/gateway/web/events.gateway.ts index fbfa13e7..62b032ef 100644 --- a/src/processors/gateway/web/events.gateway.ts +++ b/src/processors/gateway/web/events.gateway.ts @@ -23,8 +23,9 @@ import { getShortDate } from '~/utils/time.util' import { BoardcastBaseGateway } from '../base.gateway' import { DanmakuDto } from './dtos/danmaku.dto' +const namespace = 'web' @WebSocketGateway({ - namespace: 'web', + namespace, }) export class WebEventsGateway extends BoardcastBaseGateway @@ -60,7 +61,7 @@ export class WebEventsGateway async getcurrentClientCount() { const server = this.namespace.server - const sockets = await server.of('/web').adapter.sockets(new Set()) + const sockets = await server.of(`/${namespace}`).adapter.sockets(new Set()) return sockets.size } async handleConnection(socket: SocketIO.Socket) { @@ -100,6 +101,8 @@ export class WebEventsGateway override broadcast(event: BusinessEvents, data: any) { const emitter = this.cacheService.emitter - emitter.of('/web').emit('message', this.gatewayMessageFormat(event, data)) + emitter + .of(`/${namespace}`) + .emit('message', this.gatewayMessageFormat(event, data)) } } diff --git a/src/processors/redis/cache.service.ts b/src/processors/redis/cache.service.ts index 806e8d41..a94abc0b 100755 --- a/src/processors/redis/cache.service.ts +++ b/src/processors/redis/cache.service.ts @@ -61,6 +61,7 @@ export class CacheService { this._emitter = new Emitter(this.redisClient, { key: RedisIoAdapterKey, }) + return this._emitter }