From 6aff7b84f29bc0210338e0b2ddb2cf12f597faf1 Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Mon, 26 Jan 2026 13:55:20 +0000 Subject: [PATCH] unique collab serverId generation --- apps/server/src/collaboration/collaboration.gateway.ts | 4 +++- .../extensions/redis-sync/redis-sync.extension.ts | 4 ++-- apps/server/src/ee | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/server/src/collaboration/collaboration.gateway.ts b/apps/server/src/collaboration/collaboration.gateway.ts index 2f0f2085..676594b9 100644 --- a/apps/server/src/collaboration/collaboration.gateway.ts +++ b/apps/server/src/collaboration/collaboration.gateway.ts @@ -18,6 +18,8 @@ import { import { WsSocketWrapper } from './extensions/redis-sync/ws-socket-wrapper'; import RedisClient from 'ioredis'; import { pack, unpack } from 'msgpackr'; +import { nanoid } from 'nanoid'; +import * as os from 'node:os'; import { CollabWsAdapter } from './adapter/collab-ws.adapter'; import { CollaborationHandler, @@ -65,7 +67,7 @@ export class CollaborationGateway { family: this.redisConfig.family, retryStrategy: createRetryStrategy(), }), - serverId: `collab-${process.pid}`, + serverId: `collab-${os?.hostname()}-${nanoid(10)}`, prefix: 'collab', pack, unpack, diff --git a/apps/server/src/collaboration/extensions/redis-sync/redis-sync.extension.ts b/apps/server/src/collaboration/extensions/redis-sync/redis-sync.extension.ts index 7ca1198f..37f50e3e 100644 --- a/apps/server/src/collaboration/extensions/redis-sync/redis-sync.extension.ts +++ b/apps/server/src/collaboration/extensions/redis-sync/redis-sync.extension.ts @@ -1,4 +1,4 @@ -// Adapted from https://github.com/ueberdosis/hocuspocus/pull/1008 - MIT +// Source https://github.com/ueberdosis/hocuspocus/pull/1008 - MIT import { IncomingMessage } from 'node:http'; import { Extension, @@ -12,7 +12,7 @@ import RedisClient from 'ioredis'; import { readVarString } from 'lib0/decoding.js'; import { WebSocket } from 'ws'; import { CollabProxySocket } from './collab-proxy-socket'; -import { Injectable, Logger } from '@nestjs/common'; +import { Logger } from '@nestjs/common'; import { BaseWebSocket, Configuration, diff --git a/apps/server/src/ee b/apps/server/src/ee index 88e3d01f..f858f127 160000 --- a/apps/server/src/ee +++ b/apps/server/src/ee @@ -1 +1 @@ -Subproject commit 88e3d01f8135c2dbc628b9636ba91bb9ffd2f0eb +Subproject commit f858f127b55e32d34e5a2b9867bf512dd152ba09