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
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.GetLogger().Infow("updating participant permission", "permission", permission)
|
||||||
|
|
||||||
video.UpdateFromPermission(permission)
|
video.UpdateFromPermission(permission)
|
||||||
p.dirty.Store(true)
|
p.dirty.Store(true)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -14,6 +15,7 @@ import (
|
|||||||
"github.com/livekit/livekit-server/pkg/routing"
|
"github.com/livekit/livekit-server/pkg/routing"
|
||||||
"github.com/livekit/livekit-server/pkg/rtc"
|
"github.com/livekit/livekit-server/pkg/rtc"
|
||||||
"github.com/livekit/protocol/livekit"
|
"github.com/livekit/protocol/livekit"
|
||||||
|
"github.com/livekit/protocol/logger"
|
||||||
"github.com/livekit/protocol/rpc"
|
"github.com/livekit/protocol/rpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -273,20 +275,24 @@ func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.Update
|
|||||||
}
|
}
|
||||||
|
|
||||||
var participant *livekit.ParticipantInfo
|
var participant *livekit.ParticipantInfo
|
||||||
|
var detailedError error
|
||||||
err = s.confirmExecution(func() error {
|
err = s.confirmExecution(func() error {
|
||||||
participant, err = s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity))
|
participant, err = s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if req.Metadata != "" && participant.Metadata != req.Metadata {
|
if req.Metadata != "" && participant.Metadata != req.Metadata {
|
||||||
|
detailedError = fmt.Errorf("metadata does not match")
|
||||||
return ErrOperationFailed
|
return ErrOperationFailed
|
||||||
}
|
}
|
||||||
if req.Permission != nil && !proto.Equal(req.Permission, participant.Permission) {
|
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 ErrOperationFailed
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logger.Warnw("could not confirm participant update", detailedError)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user