Fix: Return NotFoundErr instead of Unavailable when the participant does not exist in UpdateParticipant. (#3543)

* Check if Participant exists when update metadata

* Change Test cases

* type smuggle oss participant check into roomstore

* tidy

---------

Co-authored-by: Paul Wells <paulwe@gmail.com>
This commit is contained in:
Soungmin Son (Eddy)
2025-03-20 23:56:34 -07:00
committed by GitHub
co-authored by Paul Wells
parent 75d0e18e4a
commit 97fcb82a77
7 changed files with 27 additions and 6 deletions
+9
View File
@@ -238,6 +238,15 @@ func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.Update
return nil, twirpAuthError(err)
}
if os, ok := s.roomStore.(OSSServiceStore); ok {
found, err := os.HasParticipant(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity))
if err != nil {
return nil, err
} else if !found {
return nil, ErrParticipantNotFound
}
}
res, err := s.participantClient.UpdateParticipant(ctx, s.topicFormatter.ParticipantTopic(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity)), req)
RecordResponse(ctx, res)
return res, err