Use ParticipantInfo version to ensure consistency (#399)

* Use ParticipantInfo version to ensure consistency

Deprecating time.Time and avoid locking unnecessarily

* properly adjust ulimit. update protocol

* Save initial version from params

* get rid of metadata field, use grants copy

* fix test
This commit is contained in:
David Zhao
2022-02-03 17:10:52 -08:00
committed by GitHub
parent 7bbd238188
commit 6f6d55345b
9 changed files with 59 additions and 53 deletions
+4 -5
View File
@@ -172,18 +172,17 @@ func TestOutOfOrderUpdates(t *testing.T) {
Sid: "PA_test2",
Identity: "test2",
Metadata: "123",
Version: 2,
}
earlierTs := time.Now()
time.Sleep(time.Millisecond)
laterTs := time.Now()
require.NoError(t, p.SendParticipantUpdate([]*livekit.ParticipantInfo{pi}, laterTs))
require.NoError(t, p.SendParticipantUpdate([]*livekit.ParticipantInfo{pi}))
pi = &livekit.ParticipantInfo{
Sid: "PA_test2",
Identity: "test2",
Metadata: "456",
Version: 1,
}
require.NoError(t, p.SendParticipantUpdate([]*livekit.ParticipantInfo{pi}, earlierTs))
require.NoError(t, p.SendParticipantUpdate([]*livekit.ParticipantInfo{pi}))
// only sent once, and it's the earlier message
require.Equal(t, 1, sink.WriteMessageCallCount())