telemetry: support roomID change for a participant (#4816)
* telemetry: support roomID change for a participant A room can get a new id while participants are connected. Key stats workers as map[roomID]map[participantID] so moving a room is a single map splice, and add reKeyRoom/RoomIDChanged to do the move. Stats collected before the change are sealed off with the room they were collected in so they stay attributed to it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * telemetry: close superseded worker on re-key collision Only one worker can be keyed at (room, participant). If a re-key lands on a room that already has a worker for the same participant, keep the one already filed there and close the superseded one so it drains and is reaped instead of lingering in the flush list. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * telemetry: hand references to the successor on force close A ReferenceGuard records that it activated some worker, not which one, so a superseded worker cannot just drop its references - the survivor would be left with references it never sees released and would never close. Hand them over instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
54496c765d
commit
5528c464a0
@@ -136,6 +136,13 @@ type FakeTelemetryService struct {
|
||||
arg2 *livekit.Room
|
||||
arg3 livekit.RoomEndReason
|
||||
}
|
||||
RoomIDChangedStub func(context.Context, livekit.RoomID, *livekit.Room)
|
||||
roomIDChangedMutex sync.RWMutex
|
||||
roomIDChangedArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.RoomID
|
||||
arg3 *livekit.Room
|
||||
}
|
||||
RoomProjectReporterStub func(context.Context) roomobs.ProjectReporter
|
||||
roomProjectReporterMutex sync.RWMutex
|
||||
roomProjectReporterArgsForCall []struct {
|
||||
@@ -915,6 +922,40 @@ func (fake *FakeTelemetryService) RoomEndedArgsForCall(i int) (context.Context,
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) RoomIDChanged(arg1 context.Context, arg2 livekit.RoomID, arg3 *livekit.Room) {
|
||||
fake.roomIDChangedMutex.Lock()
|
||||
fake.roomIDChangedArgsForCall = append(fake.roomIDChangedArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.RoomID
|
||||
arg3 *livekit.Room
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.RoomIDChangedStub
|
||||
fake.recordInvocation("RoomIDChanged", []interface{}{arg1, arg2, arg3})
|
||||
fake.roomIDChangedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.RoomIDChangedStub(arg1, arg2, arg3)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) RoomIDChangedCallCount() int {
|
||||
fake.roomIDChangedMutex.RLock()
|
||||
defer fake.roomIDChangedMutex.RUnlock()
|
||||
return len(fake.roomIDChangedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) RoomIDChangedCalls(stub func(context.Context, livekit.RoomID, *livekit.Room)) {
|
||||
fake.roomIDChangedMutex.Lock()
|
||||
defer fake.roomIDChangedMutex.Unlock()
|
||||
fake.RoomIDChangedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) RoomIDChangedArgsForCall(i int) (context.Context, livekit.RoomID, *livekit.Room) {
|
||||
fake.roomIDChangedMutex.RLock()
|
||||
defer fake.roomIDChangedMutex.RUnlock()
|
||||
argsForCall := fake.roomIDChangedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) RoomProjectReporter(arg1 context.Context) roomobs.ProjectReporter {
|
||||
fake.roomProjectReporterMutex.Lock()
|
||||
ret, specificReturn := fake.roomProjectReporterReturnsOnCall[len(fake.roomProjectReporterArgsForCall)]
|
||||
|
||||
Reference in New Issue
Block a user