Skip to content

Commit

Permalink
add config for free room limit
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Aug 5, 2024
1 parent 3dff152 commit a9110e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion server/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit a9110e7

Please sign in to comment.