Compare commits

...

2 Commits

Author SHA1 Message Date
Philipinho 207c119792 fix collab server logging too 2026-01-29 00:41:00 +00:00
Philipinho 4683a85a8b - fix: set default Nest logger and bufferLogs to false for pino compatibility
- handle redis error event
2026-01-29 00:36:48 +00:00
4 changed files with 15 additions and 3 deletions
@@ -79,6 +79,8 @@ export class RedisSyncExtension<TCE extends CustomEvents> implements Extension {
this.customEvents = (customEvents as any) ?? ({} as any as CustomEvents); this.customEvents = (customEvents as any) ?? ({} as any as CustomEvents);
this.sub.subscribe(this.msgChannel, `${this.msgChannel}:${this.serverId}`); this.sub.subscribe(this.msgChannel, `${this.msgChannel}:${this.serverId}`);
this.sub.on('messageBuffer', this.handleRedisMessage); this.sub.on('messageBuffer', this.handleRedisMessage);
this.pub.on('error', () => {});
this.sub.on('error', () => {});
} }
private getKey(documentName: string) { private getKey(documentName: string) {
return `${this.lockPrefix}:${documentName}`; return `${this.lockPrefix}:${documentName}`;
@@ -19,7 +19,8 @@ async function bootstrap() {
}, },
}), }),
{ {
bufferLogs: true, logger: false,
bufferLogs: false,
}, },
); );
+8 -2
View File
@@ -24,7 +24,11 @@ async function bootstrap() {
}), }),
{ {
rawBody: true, rawBody: true,
bufferLogs: true, // disable Nest logger so pino handles all logs
// bufferLogs must be false else pino will fail
// to log OnApplicationBootstrap logs
logger: false,
bufferLogs: false,
}, },
); );
@@ -101,7 +105,9 @@ async function bootstrap() {
const port = process.env.PORT || 3000; const port = process.env.PORT || 3000;
await app.listen(port, '0.0.0.0', () => { await app.listen(port, '0.0.0.0', () => {
logger.log(`Listening on http://127.0.0.1:${port} / ${process.env.APP_URL}`); logger.log(
`Listening on http://127.0.0.1:${port} / ${process.env.APP_URL}`,
);
}); });
} }
@@ -23,6 +23,9 @@ export class WsRedisIoAdapter extends IoAdapter {
const pubClient = new Redis(process.env.REDIS_URL, options); const pubClient = new Redis(process.env.REDIS_URL, options);
const subClient = new Redis(process.env.REDIS_URL, options); const subClient = new Redis(process.env.REDIS_URL, options);
pubClient.on('error', (err) => () => {});
subClient.on('error', (err) => () => {});
this.adapterConstructor = createAdapter(pubClient, subClient); this.adapterConstructor = createAdapter(pubClient, subClient);
} }