mirror of
https://github.com/livekit/livekit.git
synced 2026-03-30 11:19:52 +00:00
use separate allocation for signal stats telemetry guard (#4281)
This commit is contained in:
@@ -174,7 +174,7 @@ type BytesSignalStats struct {
|
||||
BytesTrackStats
|
||||
ctx context.Context
|
||||
|
||||
guard ReferenceGuard
|
||||
guard *ReferenceGuard
|
||||
|
||||
participantResolver roomobs.ParticipantReporterResolver
|
||||
trackResolver roomobs.KeyResolver
|
||||
@@ -198,6 +198,7 @@ func NewBytesSignalStats(
|
||||
reporter: trackReporter,
|
||||
},
|
||||
ctx: ctx,
|
||||
guard: &ReferenceGuard{},
|
||||
participantResolver: participantReporterResolver,
|
||||
trackResolver: trackReporterResolver,
|
||||
}
|
||||
@@ -235,7 +236,7 @@ func (s *BytesSignalStats) Reset() {
|
||||
<-s.stopped
|
||||
s.stopped = nil
|
||||
s.done = core.Fuse{}
|
||||
s.guard = ReferenceGuard{}
|
||||
s.guard = &ReferenceGuard{}
|
||||
}
|
||||
s.ri = nil
|
||||
s.pi = nil
|
||||
@@ -260,14 +261,14 @@ func (s *BytesSignalStats) maybeStart() {
|
||||
)
|
||||
s.trackResolver.Resolve(string(s.trackID))
|
||||
|
||||
s.telemetry.ParticipantJoined(s.ctx, s.ri, s.pi, nil, nil, false, &s.guard)
|
||||
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.guard)
|
||||
s.telemetry.ParticipantLeft(s.ctx, s.ri, s.pi, false, s.guard)
|
||||
close(s.stopped)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user