mirror of
https://github.com/docmost/docmost.git
synced 2025-11-18 14:31:14 +10:00
feat: standalone collab server (#767)
* feat: standalone collab server * * custom collab server port env * fix collab start script command * * API prefix * Log startup PORT * Tweak collab debounce
This commit is contained in:
@ -25,21 +25,25 @@ export class CollaborationGateway {
|
||||
this.redisConfig = parseRedisUrl(this.environmentService.getRedisUrl());
|
||||
|
||||
this.hocuspocus = HocuspocusServer.configure({
|
||||
debounce: 5000,
|
||||
maxDebounce: 10000,
|
||||
debounce: 10000,
|
||||
maxDebounce: 20000,
|
||||
unloadImmediately: false,
|
||||
extensions: [
|
||||
this.authenticationExtension,
|
||||
this.persistenceExtension,
|
||||
new Redis({
|
||||
host: this.redisConfig.host,
|
||||
port: this.redisConfig.port,
|
||||
options: {
|
||||
password: this.redisConfig.password,
|
||||
db: this.redisConfig.db,
|
||||
retryStrategy: createRetryStrategy(),
|
||||
},
|
||||
}),
|
||||
...(this.environmentService.isCollabDisableRedis()
|
||||
? []
|
||||
: [
|
||||
new Redis({
|
||||
host: this.redisConfig.host,
|
||||
port: this.redisConfig.port,
|
||||
options: {
|
||||
password: this.redisConfig.password,
|
||||
db: this.redisConfig.db,
|
||||
retryStrategy: createRetryStrategy(),
|
||||
},
|
||||
}),
|
||||
]),
|
||||
],
|
||||
});
|
||||
}
|
||||
@ -48,6 +52,14 @@ export class CollaborationGateway {
|
||||
this.hocuspocus.handleConnection(client, request);
|
||||
}
|
||||
|
||||
getConnectionCount() {
|
||||
return this.hocuspocus.getConnectionsCount();
|
||||
}
|
||||
|
||||
getDocumentCount() {
|
||||
return this.hocuspocus.getDocumentsCount();
|
||||
}
|
||||
|
||||
async destroy(): Promise<void> {
|
||||
await this.hocuspocus.destroy();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user