Configurable telemetry stats worker clean up wait. (#4148)

* Configurable telemetry stats worker clean up wait.

* make worker clean up wait setting atomic
This commit is contained in:
Raja Subramanian
2025-12-11 11:25:32 +05:30
committed by GitHub
parent d7db7cb389
commit 97099cae3e
4 changed files with 57 additions and 10 deletions
+2 -2
View File
@@ -120,7 +120,7 @@ func (s *StatsWorker) IsConnected() bool {
return s.isConnected
}
func (s *StatsWorker) Flush(now time.Time) bool {
func (s *StatsWorker) Flush(now time.Time, closeWait time.Duration) bool {
ts := timestamppb.New(now)
s.lock.Lock()
@@ -132,7 +132,7 @@ func (s *StatsWorker) Flush(now time.Time) bool {
outgoingPerTrack := s.outgoingPerTrack
s.outgoingPerTrack = make(map[livekit.TrackID][]*livekit.AnalyticsStat)
closed := !s.closedAt.IsZero() && now.Sub(s.closedAt) > workerCleanupWait
closed := !s.closedAt.IsZero() && now.Sub(s.closedAt) > closeWait
s.lock.Unlock()
stats = s.collectStats(ts, livekit.StreamType_UPSTREAM, incomingPerTrack, stats)