From 0589d757cd0b6fdfca0094ee13ac4031708fb40b Mon Sep 17 00:00:00 2001 From: Dan McFaul <55854809+real-danm@users.noreply.github.com> Date: Tue, 24 May 2022 12:30:09 -0600 Subject: [PATCH] in some implementations of Store, particpant and their tracks may not yet have been persisted when a mute event is received, don't want to error in that case (#714) --- pkg/service/roomservice.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/pkg/service/roomservice.go b/pkg/service/roomservice.go index 3f81e7281..d5bad1c24 100644 --- a/pkg/service/roomservice.go +++ b/pkg/service/roomservice.go @@ -167,25 +167,13 @@ func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteR return nil, twirpAuthError(err) } - participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity)) - if err != nil { - return nil, err - } - // find the track - t := funk.Find(participant.Tracks, func(t *livekit.TrackInfo) bool { - return t.Sid == req.TrackSid - }) - if t == nil { - return nil, twirp.NotFoundError(ErrTrackNotFound.Error()) - } - err = s.writeParticipantMessage(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity), &livekit.RTCNodeMessage{ Message: &livekit.RTCNodeMessage_MuteTrack{ MuteTrack: req, }, }) if err != nil { - return + return nil, err } var track *livekit.TrackInfo @@ -215,7 +203,7 @@ func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteR res = &livekit.MuteRoomTrackResponse{ Track: track, } - return + return res, nil } func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.UpdateParticipantRequest) (*livekit.ParticipantInfo, error) {