From b78de7bf178042c092f5bef9154a1f2a4170007e Mon Sep 17 00:00:00 2001 From: davwas Date: Tue, 14 Nov 2023 17:14:57 +0100 Subject: [PATCH] add more console logs --- .../tldraw/service/tldraw.ws.service.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/server/src/modules/tldraw/service/tldraw.ws.service.ts b/apps/server/src/modules/tldraw/service/tldraw.ws.service.ts index c4496a40e16..dbe1cdc9c5e 100644 --- a/apps/server/src/modules/tldraw/service/tldraw.ws.service.ts +++ b/apps/server/src/modules/tldraw/service/tldraw.ws.service.ts @@ -99,15 +99,20 @@ export class TldrawWsService { */ public updateHandler(update: Uint8Array, origin, doc: WsSharedDocDo): void { const isOriginWSConn = origin instanceof WebSocket && doc.conns.has(origin); - + console.log('Update Handler, isOriginWSConn: ', isOriginWSConn); if (isOriginWSConn) { + console.log('Update Handler, before promise'); void Promise.all([ this.pub.publishBuffer(doc.name, Buffer.from(update)), pushDocUpdatesToQueue(this.pub, doc, update), - ]).then((result) => { - console.log(`Update handler redis response: ${result[0]}`); - return null; - }); + ]) + .then((result) => { + console.log('Update handler redis response:', result[0]); + return null; + }) + .catch((err) => { + console.log('Update Handler Promise Error: ', err); + }); this.propagateUpdate(update, doc); } else { @@ -153,7 +158,7 @@ export class TldrawWsService { case WSMessageType.AWARENESS: { const update = decoding.readVarUint8Array(decoder); const pubResponse = await this.pub.publishBuffer(doc.awarenessChannel, Buffer.from(update)); - console.log(`Message handler awareness response: ${pubResponse}`); + console.log('Message handler awareness response:', pubResponse); applyAwarenessUpdate(doc.awareness, update, conn); break; } @@ -181,7 +186,7 @@ export class TldrawWsService { }); const redisUpdates = await getDocUpdatesFromQueue(this.pub, doc); - console.log(`Setup WS Connection redis updates: ${redisUpdates.toString()}`); + console.log('Setup WS Connection redis updates: ', redisUpdates); const redisYDoc = new Doc(); redisYDoc.transact(() => { for (const u of redisUpdates) {