Variable collision killed stats workers (#670)
This commit is contained in:
@@ -52,7 +52,7 @@ func (t *telemetryServiceInternal) ParticipantJoined(
|
|||||||
clientInfo *livekit.ClientInfo,
|
clientInfo *livekit.ClientInfo,
|
||||||
clientMeta *livekit.AnalyticsClientMeta,
|
clientMeta *livekit.AnalyticsClientMeta,
|
||||||
) {
|
) {
|
||||||
w := newStatsWorker(
|
newWorker := newStatsWorker(
|
||||||
ctx,
|
ctx,
|
||||||
t,
|
t,
|
||||||
livekit.RoomID(room.Sid),
|
livekit.RoomID(room.Sid),
|
||||||
@@ -62,20 +62,20 @@ func (t *telemetryServiceInternal) ParticipantJoined(
|
|||||||
)
|
)
|
||||||
t.workersMu.Lock()
|
t.workersMu.Lock()
|
||||||
var free = false
|
var free = false
|
||||||
for idx, w := range t.workers {
|
for idx, worker := range t.workers {
|
||||||
if w != nil {
|
if worker != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
free = true
|
free = true
|
||||||
t.workersIdx[livekit.ParticipantID(participant.Sid)] = idx
|
t.workersIdx[livekit.ParticipantID(participant.Sid)] = idx
|
||||||
t.workers[idx] = w
|
t.workers[idx] = newWorker
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if !free {
|
if !free {
|
||||||
t.workersIdx[livekit.ParticipantID(participant.Sid)] = len(t.workers)
|
t.workersIdx[livekit.ParticipantID(participant.Sid)] = len(t.workers)
|
||||||
t.workers = append(t.workers, w)
|
t.workers = append(t.workers, newWorker)
|
||||||
}
|
}
|
||||||
t.workersMu.Unlock()
|
t.workersMu.Unlock()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user