( ctx context.Context, roomID livekit.RoomID, roomName livekit.RoomName, participantID livekit.ParticipantID, participantIdentity livekit.ParticipantIdentity, guard *ReferenceGuard, )
| 271 | } |
| 272 | |
| 273 | func (t *telemetryService) getOrCreateWorker( |
| 274 | ctx context.Context, |
| 275 | roomID livekit.RoomID, |
| 276 | roomName livekit.RoomName, |
| 277 | participantID livekit.ParticipantID, |
| 278 | participantIdentity livekit.ParticipantIdentity, |
| 279 | guard *ReferenceGuard, |
| 280 | ) (*StatsWorker, bool) { |
| 281 | t.workersMu.Lock() |
| 282 | defer t.workersMu.Unlock() |
| 283 | |
| 284 | key := statsWorkerKey{roomID, participantID} |
| 285 | worker, ok := t.workers[key] |
| 286 | if ok && !worker.Closed(guard) { |
| 287 | return worker, true |
| 288 | } |
| 289 | |
| 290 | existingIsConnected := false |
| 291 | if ok { |
| 292 | existingIsConnected = worker.IsConnected() |
| 293 | } |
| 294 | |
| 295 | worker = newStatsWorker( |
| 296 | ctx, |
| 297 | t, |
| 298 | roomID, |
| 299 | roomName, |
| 300 | participantID, |
| 301 | participantIdentity, |
| 302 | guard, |
| 303 | ) |
| 304 | if existingIsConnected { |
| 305 | worker.SetConnected() |
| 306 | } |
| 307 | |
| 308 | t.workers[key] = worker |
| 309 | |
| 310 | worker.next = t.workerList |
| 311 | t.workerList = worker |
| 312 | |
| 313 | return worker, false |
| 314 | } |
| 315 | |
| 316 | func (t *telemetryService) LocalRoomState(ctx context.Context, info *livekit.AnalyticsNodeRooms) { |
| 317 | t.enqueue(func() { |
no test coverage detected