mirror of
https://github.com/docmost/docmost.git
synced 2026-07-27 12:44:40 +10:00
unique collab serverId generation
This commit is contained in:
@@ -18,6 +18,8 @@ import {
|
|||||||
import { WsSocketWrapper } from './extensions/redis-sync/ws-socket-wrapper';
|
import { WsSocketWrapper } from './extensions/redis-sync/ws-socket-wrapper';
|
||||||
import RedisClient from 'ioredis';
|
import RedisClient from 'ioredis';
|
||||||
import { pack, unpack } from 'msgpackr';
|
import { pack, unpack } from 'msgpackr';
|
||||||
|
import { nanoid } from 'nanoid';
|
||||||
|
import * as os from 'node:os';
|
||||||
import { CollabWsAdapter } from './adapter/collab-ws.adapter';
|
import { CollabWsAdapter } from './adapter/collab-ws.adapter';
|
||||||
import {
|
import {
|
||||||
CollaborationHandler,
|
CollaborationHandler,
|
||||||
@@ -65,7 +67,7 @@ export class CollaborationGateway {
|
|||||||
family: this.redisConfig.family,
|
family: this.redisConfig.family,
|
||||||
retryStrategy: createRetryStrategy(),
|
retryStrategy: createRetryStrategy(),
|
||||||
}),
|
}),
|
||||||
serverId: `collab-${process.pid}`,
|
serverId: `collab-${os?.hostname()}-${nanoid(10)}`,
|
||||||
prefix: 'collab',
|
prefix: 'collab',
|
||||||
pack,
|
pack,
|
||||||
unpack,
|
unpack,
|
||||||
|
|||||||
@@ -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 { IncomingMessage } from 'node:http';
|
||||||
import {
|
import {
|
||||||
Extension,
|
Extension,
|
||||||
@@ -12,7 +12,7 @@ import RedisClient from 'ioredis';
|
|||||||
import { readVarString } from 'lib0/decoding.js';
|
import { readVarString } from 'lib0/decoding.js';
|
||||||
import { WebSocket } from 'ws';
|
import { WebSocket } from 'ws';
|
||||||
import { CollabProxySocket } from './collab-proxy-socket';
|
import { CollabProxySocket } from './collab-proxy-socket';
|
||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Logger } from '@nestjs/common';
|
||||||
import {
|
import {
|
||||||
BaseWebSocket,
|
BaseWebSocket,
|
||||||
Configuration,
|
Configuration,
|
||||||
|
|||||||
+1
-1
Submodule apps/server/src/ee updated: 88e3d01f81...f858f127b5
Reference in New Issue
Block a user