egress participants don't count towards max (#1279)

This commit is contained in:
David Colburn
2023-01-03 09:38:58 +08:00
committed by GitHub
parent 4ba7e57683
commit 24664b1284
+12 -3
View File
@@ -230,9 +230,18 @@ func (r *Room) Join(participant types.LocalParticipant, opts *ParticipantOptions
return ErrAlreadyJoined
}
if r.protoRoom.MaxParticipants > 0 && len(r.participants) >= int(r.protoRoom.MaxParticipants) {
prometheus.ServiceOperationCounter.WithLabelValues("participant_join", "error", "max_exceeded").Add(1)
return ErrMaxParticipantsExceeded
if r.protoRoom.MaxParticipants > 0 && !participant.IsRecorder() {
participantCount := 0
for _, p := range r.participants {
if !p.IsRecorder() {
participantCount++
}
}
if participantCount >= int(r.protoRoom.MaxParticipants) {
prometheus.ServiceOperationCounter.WithLabelValues("participant_join", "error", "max_exceeded").Add(1)
return ErrMaxParticipantsExceeded
}
}
if r.FirstJoinedAt() == 0 {