backend: Update room service to utilize MEETING_EMPTY_TIMEOUT and MEETING_DEPARTURE_TIMEOUT for LiveKit room options
This commit is contained in:
parent
710b2c0659
commit
ecb50ec0e9
@ -31,7 +31,11 @@ const INTERNAL_CONFIG = {
|
|||||||
|
|
||||||
CRON_JOB_MIN_LOCK_TTL: '59s' as StringValue, // Minimum TTL for cron job locks
|
CRON_JOB_MIN_LOCK_TTL: '59s' as StringValue, // Minimum TTL for cron job locks
|
||||||
// Additional intervals
|
// Additional intervals
|
||||||
MIN_FUTURE_TIME_FOR_ROOM_AUTODELETION_DATE: '1h' as StringValue
|
MIN_FUTURE_TIME_FOR_ROOM_AUTODELETION_DATE: '1h' as StringValue, // Minimum time for room auto-deletion date
|
||||||
|
// !FIXME (LK BUG): When this is defined, the room will be closed although there are participants
|
||||||
|
MEETING_EMPTY_TIMEOUT: '' as StringValue, // Seconds to keep the meeting (LK room) open until the first participant joins
|
||||||
|
// !FIXME (LK BUG): When this is defined, the room will be closed although there are participants
|
||||||
|
MEETING_DEPARTURE_TIMEOUT: '' as StringValue // Seconds to keep the meeting (LK room) open after the last participant leaves
|
||||||
};
|
};
|
||||||
|
|
||||||
// This function is used to set private configuration values for testing purposes.
|
// This function is used to set private configuration values for testing purposes.
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import {
|
|||||||
TaskSchedulerService,
|
TaskSchedulerService,
|
||||||
TokenService
|
TokenService
|
||||||
} from './index.js';
|
} from './index.js';
|
||||||
|
import ms from 'ms';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service for managing OpenVidu Meet rooms.
|
* Service for managing OpenVidu Meet rooms.
|
||||||
@ -94,21 +95,19 @@ export class RoomService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const meetRoom: MeetRoom = await this.getMeetRoom(roomId);
|
const meetRoom: MeetRoom = await this.getMeetRoom(roomId);
|
||||||
|
const { MEETING_DEPARTURE_TIMEOUT, MEETING_EMPTY_TIMEOUT } = INTERNAL_CONFIG;
|
||||||
const livekitRoomOptions: CreateOptions = {
|
const livekitRoomOptions: CreateOptions = {
|
||||||
name: roomId,
|
name: roomId,
|
||||||
metadata: JSON.stringify({
|
metadata: JSON.stringify({
|
||||||
roomOptions: MeetRoomHelper.toOpenViduOptions(meetRoom)
|
roomOptions: MeetRoomHelper.toOpenViduOptions(meetRoom)
|
||||||
})
|
}),
|
||||||
//TODO: Uncomment this when bug in LiveKit is fixed
|
emptyTimeout: MEETING_EMPTY_TIMEOUT ? ms(MEETING_EMPTY_TIMEOUT) / 1000 : undefined,
|
||||||
// When it is defined, the room will be closed although there are participants
|
departureTimeout: MEETING_DEPARTURE_TIMEOUT ? ms(MEETING_DEPARTURE_TIMEOUT) / 1000 : undefined
|
||||||
// emptyTimeout: ms('20s') / 1000,
|
|
||||||
// !FIXME: When this is defined, the room will be closed although there are participants
|
|
||||||
// departureTimeout: ms('20s') / 1000
|
|
||||||
// maxParticipants: maxParticipants || undefined,
|
// maxParticipants: maxParticipants || undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
const room = await this.livekitService.createRoom(livekitRoomOptions);
|
const room = await this.livekitService.createRoom(livekitRoomOptions);
|
||||||
this.logger.verbose(`Room ${roomId} created in LiveKit.`);
|
this.logger.verbose(`Room ${roomId} created in LiveKit with options: ${JSON.stringify(livekitRoomOptions)}.`);
|
||||||
return room;
|
return room;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user