add idempotent reference count to telemetry stats worker (#3964)

* add idempotent reference guard to telemetry stats worker

* tidy

* sync

* tidy
This commit is contained in:
Paul Wells
2025-09-29 02:35:16 -07:00
committed by GitHub
parent 735c663adc
commit 3d73703152
12 changed files with 198 additions and 55 deletions
+4 -2
View File
@@ -174,6 +174,8 @@ type BytesSignalStats struct {
BytesTrackStats
ctx context.Context
guard ReferenceGuard
participantResolver roomobs.ParticipantReporterResolver
trackResolver roomobs.KeyResolver
@@ -257,14 +259,14 @@ func (s *BytesSignalStats) maybeStart() {
)
s.trackResolver.Resolve(string(s.trackID))
s.telemetry.ParticipantJoined(s.ctx, s.ri, s.pi, nil, nil, false)
s.telemetry.ParticipantJoined(s.ctx, s.ri, s.pi, nil, nil, false, &s.guard)
s.stopped = make(chan struct{})
go s.worker()
}
func (s *BytesSignalStats) worker() {
s.BytesTrackStats.worker()
s.telemetry.ParticipantLeft(s.ctx, s.ri, s.pi, false)
s.telemetry.ParticipantLeft(s.ctx, s.ri, s.pi, false, &s.guard)
close(s.stopped)
}