add ctx to interfaces (#105)
* add ctx to interfaces * use existing context
This commit is contained in:
+11
-11
@@ -30,7 +30,7 @@ func (s *RoomService) CreateRoom(ctx context.Context, req *livekit.CreateRoomReq
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
rm, err = s.roomManager.CreateRoom(req)
|
||||
rm, err = s.roomManager.CreateRoom(ctx, req)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "could not create room")
|
||||
}
|
||||
@@ -44,7 +44,7 @@ func (s *RoomService) ListRooms(ctx context.Context, req *livekit.ListRoomsReque
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
rooms, err := s.roomManager.ListRooms()
|
||||
rooms, err := s.roomManager.ListRooms(ctx)
|
||||
if err != nil {
|
||||
// TODO: translate error codes to twirp
|
||||
return
|
||||
@@ -62,7 +62,7 @@ func (s *RoomService) DeleteRoom(ctx context.Context, req *livekit.DeleteRoomReq
|
||||
}
|
||||
// if the room is currently active, RTC node needs to disconnect clients
|
||||
// here we are using any user's identity, due to how it works with routing
|
||||
participants, err := s.roomManager.ListParticipants(req.Room)
|
||||
participants, err := s.roomManager.ListParticipants(ctx, req.Room)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -78,7 +78,7 @@ func (s *RoomService) DeleteRoom(ctx context.Context, req *livekit.DeleteRoomReq
|
||||
}
|
||||
} else {
|
||||
// if a room hasn't started, delete locally
|
||||
if err = s.roomManager.DeleteRoom(req.Room); err != nil {
|
||||
if err = s.roomManager.DeleteRoom(ctx, req.Room); err != nil {
|
||||
err = twirp.WrapError(twirp.InternalError("could not delete room"), err)
|
||||
return nil, err
|
||||
}
|
||||
@@ -92,7 +92,7 @@ func (s *RoomService) ListParticipants(ctx context.Context, req *livekit.ListPar
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
participants, err := s.roomManager.ListParticipants(req.Room)
|
||||
participants, err := s.roomManager.ListParticipants(ctx, req.Room)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -108,7 +108,7 @@ func (s *RoomService) GetParticipant(ctx context.Context, req *livekit.RoomParti
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
participant, err := s.roomManager.LoadParticipant(req.Room, req.Identity)
|
||||
participant, err := s.roomManager.LoadParticipant(ctx, req.Room, req.Identity)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -136,7 +136,7 @@ func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteR
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
participant, err := s.roomManager.LoadParticipant(req.Room, req.Identity)
|
||||
participant, err := s.roomManager.LoadParticipant(ctx, req.Room, req.Identity)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -176,7 +176,7 @@ func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.Update
|
||||
return nil, err
|
||||
}
|
||||
|
||||
participant, err := s.roomManager.LoadParticipant(req.Room, req.Identity)
|
||||
participant, err := s.roomManager.LoadParticipant(ctx, req.Room, req.Identity)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -200,7 +200,7 @@ func (s *RoomService) UpdateSubscriptions(ctx context.Context, req *livekit.Upda
|
||||
|
||||
func (s *RoomService) SendData(ctx context.Context, req *livekit.SendDataRequest) (*livekit.SendDataResponse, error) {
|
||||
// here we are using any user's identity, due to how it works with routing
|
||||
participants, err := s.roomManager.ListParticipants(req.Room)
|
||||
participants, err := s.roomManager.ListParticipants(ctx, req.Room)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -224,12 +224,12 @@ func (s *RoomService) createRTCSink(ctx context.Context, room, identity string)
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
_, err := s.roomManager.LoadParticipant(room, identity)
|
||||
_, err := s.roomManager.LoadParticipant(ctx, room, identity)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.router.CreateRTCSink(room, identity)
|
||||
return s.router.CreateRTCSink(ctx, room, identity)
|
||||
}
|
||||
|
||||
func (s *RoomService) writeMessage(ctx context.Context, room, identity string, msg *livekit.RTCNodeMessage) error {
|
||||
|
||||
Reference in New Issue
Block a user