From c40150085ad7569c7850cbecfcdd584a25604e32 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Tue, 13 Jan 2026 09:36:09 +0530 Subject: [PATCH] Clear participant version cache on disconnect (#4234) * debug participant update * more debug * context logger * log participant info * more logging * clear participant cache on disconnect * clean up * clean up --- pkg/rtc/participant.go | 2 +- pkg/rtc/participant_signal.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index 1988052d9..a436098f3 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -282,7 +282,7 @@ type ParticipantImpl struct { // queued participant updates before join response is sent // guarded by updateLock queuedUpdates []*livekit.ParticipantInfo - // cache of recently sent updates, to ensuring ordering by version + // cache of recently sent updates, to ensure ordering by version // guarded by updateLock updateCache *lru.Cache[livekit.ParticipantID, participantUpdateInfo] updateLock utils.Mutex diff --git a/pkg/rtc/participant_signal.go b/pkg/rtc/participant_signal.go index 3fa388adc..adadc44ac 100644 --- a/pkg/rtc/participant_signal.go +++ b/pkg/rtc/participant_signal.go @@ -118,6 +118,10 @@ func (p *ParticipantImpl) SendParticipantUpdate(participantsToUpdate []*livekit. }) validUpdates = append(validUpdates, pi) } + + if pi.State == livekit.ParticipantInfo_DISCONNECTED { + p.updateCache.Remove(pID) + } } p.updateLock.Unlock()