Skip room updates to participants unless they are active

This commit is contained in:
David Zhao
2023-04-24 15:24:50 -07:00
parent 09c0b25787
commit b4ea4de5c0
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -417,7 +417,7 @@ func (r *Room) ResumeParticipant(p types.LocalParticipant, requestSource routing
return err
}
p.SendRoomUpdate(r.ToProto())
_ = p.SendRoomUpdate(r.ToProto())
p.ICERestart(nil)
return nil
}
@@ -667,7 +667,9 @@ func (r *Room) sendRoomUpdate() {
roomInfo := r.ToProto()
// Send update to participants
for _, p := range r.GetParticipants() {
if !p.IsReady() {
// new participants receive the update as part of JoinResponse
// skip inactive participants
if p.State() != livekit.ParticipantInfo_ACTIVE {
continue
}
+1 -1
View File
@@ -678,7 +678,7 @@ func TestRoomUpdate(t *testing.T) {
// p1 should have received an update
time.Sleep(2 * defaultDelay)
require.GreaterOrEqual(t, p1.SendRoomUpdateCallCount(), 1)
require.Equal(t, 1, p1.SendRoomUpdateCallCount())
require.EqualValues(t, 2, p1.SendRoomUpdateArgsForCall(p1.SendRoomUpdateCallCount()-1).NumParticipants)
})