mirror of
https://github.com/livekit/livekit.git
synced 2026-03-30 15:35:41 +00:00
Log additional details when updating participant permissions (#1855)
To help track down sporadic updateParticipant failures
This commit is contained in:
@@ -370,6 +370,8 @@ func (p *ParticipantImpl) SetPermission(permission *livekit.ParticipantPermissio
|
||||
return false
|
||||
}
|
||||
|
||||
p.GetLogger().Infow("updating participant permission", "permission", permission)
|
||||
|
||||
video.UpdateFromPermission(permission)
|
||||
p.dirty.Store(true)
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
@@ -14,6 +15,7 @@ import (
|
||||
"github.com/livekit/livekit-server/pkg/routing"
|
||||
"github.com/livekit/livekit-server/pkg/rtc"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/logger"
|
||||
"github.com/livekit/protocol/rpc"
|
||||
)
|
||||
|
||||
@@ -273,20 +275,24 @@ func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.Update
|
||||
}
|
||||
|
||||
var participant *livekit.ParticipantInfo
|
||||
var detailedError error
|
||||
err = s.confirmExecution(func() error {
|
||||
participant, err = s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if req.Metadata != "" && participant.Metadata != req.Metadata {
|
||||
detailedError = fmt.Errorf("metadata does not match")
|
||||
return ErrOperationFailed
|
||||
}
|
||||
if req.Permission != nil && !proto.Equal(req.Permission, participant.Permission) {
|
||||
detailedError = fmt.Errorf("permissions do not match, expected: %v, actual: %v", req.Permission, participant.Permission)
|
||||
return ErrOperationFailed
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
logger.Warnw("could not confirm participant update", detailedError)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user