Postpone sending breakout rooms invitations to after all breakout rooms are successfully created.

This commit is contained in:
Ghazi Triki 2016-08-18 08:03:34 +01:00
parent 4f4f2a71ef
commit 9e32890d1b
2 changed files with 21 additions and 5 deletions

View File

@ -35,7 +35,13 @@ trait BreakoutRoomApp extends SystemConfiguration {
} }
def handleCreateBreakoutRooms(msg: CreateBreakoutRooms) { def handleCreateBreakoutRooms(msg: CreateBreakoutRooms) {
// If breakout rooms are being created we ignore the coming message
if (breakoutModel.pendingRoomsNumber > 0) {
log.warning("CreateBreakoutRooms event received while {} are pending to be created for meeting {}", breakoutModel.pendingRoomsNumber, mProps.meetingID)
return
}
var i = 0 var i = 0
breakoutModel.pendingRoomsNumber = msg.rooms.length;
for (room <- msg.rooms) { for (room <- msg.rooms) {
i += 1 i += 1
val presURL = bbbWebDefaultPresentationURL val presURL = bbbWebDefaultPresentationURL
@ -67,17 +73,25 @@ trait BreakoutRoomApp extends SystemConfiguration {
} }
def handleBreakoutRoomCreated(msg: BreakoutRoomCreated) { def handleBreakoutRoomCreated(msg: BreakoutRoomCreated) {
breakoutModel.pendingRoomsNumber -= 1
val room = breakoutModel.getBreakoutRoom(msg.breakoutRoomId) val room = breakoutModel.getBreakoutRoom(msg.breakoutRoomId)
room foreach { room => room foreach { room =>
sendBreakoutRoomStarted(mProps.meetingID, room.name, room.id, room.voiceConfId) sendBreakoutRoomStarted(mProps.meetingID, room.name, room.id, room.voiceConfId)
} }
breakoutModel.getAssignedUsers(msg.breakoutRoomId) foreach { users => // We avoid sending invitation
users.foreach { u => if (breakoutModel.pendingRoomsNumber == 0) {
log.debug("## Sending Join URL for users: {}", u); log.info("All breakout rooms created for meetingId={}", mProps.meetingID)
sendJoinURL(u, msg.breakoutRoomId) breakoutModel.getRooms().foreach { room =>
breakoutModel.getAssignedUsers(room.id) foreach { users =>
users.foreach { u =>
log.debug("## Sending Join URL for users: {}", u);
sendJoinURL(u, room.id)
}
}
} }
} }
} }
def sendBreakoutRoomStarted(meetingId: String, breakoutName: String, breakoutId: String, voiceConfId: String) { def sendBreakoutRoomStarted(meetingId: String, breakoutName: String, breakoutId: String, voiceConfId: String) {

View File

@ -9,7 +9,9 @@ case class BreakoutRoom(id: String, name: String, voiceConfId: String,
class BreakoutRoomModel { class BreakoutRoomModel {
private var rooms = new collection.immutable.HashMap[String, BreakoutRoom] private var rooms = new collection.immutable.HashMap[String, BreakoutRoom]
var pendingRoomsNumber: Integer = 0
def add(room: BreakoutRoom): BreakoutRoom = { def add(room: BreakoutRoom): BreakoutRoom = {
rooms += room.id -> room rooms += room.id -> room
room room