Skip to content

Commit

Permalink
Iterate handleSplitUsers so it always tries to add user to room with …
Browse files Browse the repository at this point in the history
…least number of users
  • Loading branch information
Daniel Fosco committed Dec 13, 2023
1 parent 02e9a81 commit 61ac30b
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,11 @@ export const BreakoutManager: React.FC = () => {
usersInRooms.push(users.slice(i, i + roomSize));
}

// Sort rooms by number of participants in ascending order
const sortedRooms = [...rooms].sort((a, b) => a.participants.length - b.participants.length);

for (let i = 0; i < count; ++i) {
const room = rooms[i];
const room = sortedRooms[i];
const participants = usersInRooms[i];
for (const participant of participants) {
await service.addParticipant(room, participant);
Expand Down

0 comments on commit 61ac30b

Please sign in to comment.