mirror of
https://github.com/livekit/livekit.git
synced 2026-07-20 22:11:10 +00:00
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user