@@ -20,12 +20,11 @@ import { CollaborationUseCase } from '../../application/collaboration.use-case';
2020@WebSocketGateway ( {
2121 cors : false ,
2222 path : '/v1/card-sets/ws' ,
23- pingTimeout : 60000 ,
23+ pingTimeout : 10000 ,
2424 pingInterval : 25000 ,
2525} )
2626export class CollaborationGateway
27- implements OnGatewayConnection , OnGatewayDisconnect
28- {
27+ implements OnGatewayConnection , OnGatewayDisconnect {
2928 @WebSocketServer ( )
3029 server ! : Server ;
3130
@@ -39,7 +38,7 @@ export class CollaborationGateway
3938 constructor (
4039 private readonly yjsDocumentService : YjsDocumentService ,
4140 private readonly collaborationUseCase : CollaborationUseCase ,
42- ) { }
41+ ) { }
4342
4443 handleConnection ( client : Socket ) {
4544 this . logger . log ( `[클라이언트 연결] clientId=${ client . id } ` ) ;
@@ -330,8 +329,14 @@ export class CollaborationGateway
330329 if ( activeCount > 0 ) return ;
331330
332331 try {
333- await this . collaborationUseCase . saveCardsetContent ( Number ( cardsetId ) ) ;
334- this . logger . log ( `Flushed cardset ${ cardsetId } snapshot to database` ) ;
332+ await this . yjsDocumentService . flushIncrementalHistory ( cardsetId ) ;
333+ this . logger . log (
334+ `[cardset flush 완료] 증분값 DB 저장 완료 - cardsetId=${ cardsetId } ` ,
335+ ) ;
336+ await this . yjsDocumentService . deleteDocument ( cardsetId ) ;
337+ this . logger . log (
338+ `[Redis 문서 삭제] 방 비어있어 Redis 문서 삭제 완료 - cardsetId=${ cardsetId } ` ,
339+ ) ;
335340 } catch ( error ) {
336341 this . logger . error ( `Failed to flush cardset ${ cardsetId } :` , error ) ;
337342 }
0 commit comments