mirror of
https://github.com/livekit/livekit.git
synced 2026-11-23 02:29:22 +00:00
service: stamp the join request time for every participant kind (#5240)
lk.rtc.joinRequestTime was set only for standard participants. SIP, agent, egress and other participants now get it too, so the time a participant reached the signal node is known for every kind. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a2880d6978
commit
d1b95c28b3
2 files changed
+12
-6
No files matched your search
@@ -782,9 +782,9 @@ func (s *RTCService) startConnection(
|
||||
return cr, initialResponse, nil
|
||||
}
|
||||
|
||||
// stampJoinRequestTime sets when the server received a new user's join request.
|
||||
// stampJoinRequestTime sets when the server received a new participant's join request.
|
||||
func stampJoinRequestTime(pi *routing.ParticipantInit, at time.Time) {
|
||||
if pi.Reconnect || pi.Grants.GetParticipantKind() != livekit.ParticipantInfo_STANDARD {
|
||||
if pi.Reconnect {
|
||||
return
|
||||
}
|
||||
if pi.Grants.Attributes == nil {
|
||||
|
||||
@@ -125,9 +125,15 @@ func TestStampJoinRequestTime(t *testing.T) {
|
||||
require.Empty(t, stamped(routing.ParticipantInit{Reconnect: true, Grants: &auth.ClaimGrants{}}))
|
||||
})
|
||||
|
||||
t.Run("agent", func(t *testing.T) {
|
||||
grants := &auth.ClaimGrants{}
|
||||
grants.SetParticipantKind(livekit.ParticipantInfo_AGENT)
|
||||
require.Empty(t, stamped(routing.ParticipantInit{Grants: grants}))
|
||||
t.Run("every participant kind", func(t *testing.T) {
|
||||
for _, kind := range []livekit.ParticipantInfo_Kind{
|
||||
livekit.ParticipantInfo_SIP,
|
||||
livekit.ParticipantInfo_AGENT,
|
||||
livekit.ParticipantInfo_EGRESS,
|
||||
} {
|
||||
grants := &auth.ClaimGrants{}
|
||||
grants.SetParticipantKind(kind)
|
||||
require.Equal(t, map[string]string{livekit.AttrRTCJoinRequestTime: "1700000000123"}, stamped(routing.ParticipantInit{Grants: grants}), kind.String())
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user