Skip to content

Commit 0381836

Browse files
committed
chore: generate new uuid
Signed-off-by: nikolay <[email protected]>
1 parent a7d183a commit 0381836

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

packages/ws-server/src/webSocketServer.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@ const mainLogger = pino({
3333
// https://github.com/pinojs/pino/blob/main/docs/api.md#mixin-function
3434
mixin: () => {
3535
const store = context.getStore();
36-
return store
37-
? {
38-
connectionId: `[Connection ID: ${store.connectionId}] `,
39-
requestId: `[Request ID: ${store.requestId}] `,
40-
}
41-
: {};
36+
if (store) {
37+
// generate a new uuid for each request within a single connection
38+
store.requestId = uuid();
39+
40+
return {
41+
connectionId: `[Connection ID: ${store.connectionId}] `,
42+
requestId: `[Request ID: ${store.requestId}] `,
43+
};
44+
}
45+
return {};
4246
},
4347
transport: {
4448
target: 'pino-pretty',

0 commit comments

Comments
 (0)