From a9110e71e03266d2d43e385bd68dbf4810d4387d Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 5 Aug 2024 02:15:12 +0000 Subject: [PATCH] add config for free room limit --- server/config.ts | 1 + server/room.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/server/config.ts b/server/config.ts index 62f296d2cd..58139a05b5 100644 --- a/server/config.ts +++ b/server/config.ts @@ -43,6 +43,7 @@ const defaults = { BUILD_DIRECTORY: 'build', // Name of the directory where the built React UI is served from VM_MIN_UPTIME_MINUTES: 0, // Number of minutes of the hour VMs must exist for before being eligible for termination SHARD: undefined, // Shard ID of the web server (configure in ecosystem.config.js) + FREE_ROOM_LIMIT: 1, // The maximum number of rooms a free user can have SUBSCRIBER_ROOM_LIMIT: 20, // The maximum number of rooms a subscriber can have VMWORKER_PORT: 3100, // Port to use for the vmWorker HTTP server VM_ASSIGNMENT_TIMEOUT: 75, // Number of seconds to wait for a VM before failing diff --git a/server/room.ts b/server/room.ts index aa8a9f8323..172918f344 100644 --- a/server/room.ts +++ b/server/room.ts @@ -1135,7 +1135,9 @@ export class Room { [owner, this.roomId], ) ).rows[0].count; - const limit = isSubscriber ? config.SUBSCRIBER_ROOM_LIMIT : 1; + const limit = isSubscriber + ? config.SUBSCRIBER_ROOM_LIMIT + : config.FREE_ROOM_LIMIT; if (roomCount >= limit) { socket.emit( 'errorMessage',