Skip room updates to participants unless they are active
This commit is contained in:
+4
-2
@@ -417,7 +417,7 @@ func (r *Room) ResumeParticipant(p types.LocalParticipant, requestSource routing
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
p.SendRoomUpdate(r.ToProto())
|
_ = p.SendRoomUpdate(r.ToProto())
|
||||||
p.ICERestart(nil)
|
p.ICERestart(nil)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -667,7 +667,9 @@ func (r *Room) sendRoomUpdate() {
|
|||||||
roomInfo := r.ToProto()
|
roomInfo := r.ToProto()
|
||||||
// Send update to participants
|
// Send update to participants
|
||||||
for _, p := range r.GetParticipants() {
|
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -678,7 +678,7 @@ func TestRoomUpdate(t *testing.T) {
|
|||||||
|
|
||||||
// p1 should have received an update
|
// p1 should have received an update
|
||||||
time.Sleep(2 * defaultDelay)
|
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)
|
require.EqualValues(t, 2, p1.SendRoomUpdateArgsForCall(p1.SendRoomUpdateCallCount()-1).NumParticipants)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user