consolidate room internal (#1030)

* consolidate room internal

* create room internal map

* pipelined room read

* check error

* fix pipelined reads

* clean up after test
This commit is contained in:
David Colburn
2022-09-22 15:59:27 -07:00
committed by GitHub
parent 20c565ca02
commit b97d59b8db
15 changed files with 168 additions and 372 deletions
+3 -8
View File
@@ -317,7 +317,7 @@ func (r *RoomManager) StartSession(
updateParticipantCount := func(proto *livekit.Room) {
if !participant.Hidden() {
err = r.roomStore.StoreRoom(ctx, proto)
err = r.roomStore.StoreRoom(ctx, proto, room.Internal())
if err != nil {
logger.Errorw("could not store room", err)
}
@@ -371,12 +371,7 @@ func (r *RoomManager) getOrCreateRoom(ctx context.Context, roomName livekit.Room
}
// create new room, get details first
ri, err := r.roomStore.LoadRoom(ctx, roomName)
if err != nil {
return nil, err
}
internal, err := r.roomStore.LoadRoomInternal(ctx, roomName)
ri, internal, err := r.roomStore.LoadRoom(ctx, roomName, true)
if err != nil {
return nil, err
}
@@ -410,7 +405,7 @@ func (r *RoomManager) getOrCreateRoom(ctx context.Context, roomName livekit.Room
})
newRoom.OnMetadataUpdate(func(metadata string) {
if err := r.roomStore.StoreRoom(ctx, newRoom.ToProto()); err != nil {
if err := r.roomStore.StoreRoom(ctx, newRoom.ToProto(), newRoom.Internal()); err != nil {
newRoom.Logger.Errorw("could not handle metadata update", err)
}
})