Wait for metadata update. (#2363)
This commit is contained in:
+2
-2
@@ -767,11 +767,11 @@ func (r *Room) SendDataPacket(up *livekit.UserPacket, kind livekit.DataPacket_Ki
|
||||
r.onDataPacket(nil, dp)
|
||||
}
|
||||
|
||||
func (r *Room) SetMetadata(metadata string) {
|
||||
func (r *Room) SetMetadata(metadata string) <-chan struct{} {
|
||||
r.lock.Lock()
|
||||
r.protoRoom.Metadata = metadata
|
||||
r.lock.Unlock()
|
||||
r.protoProxy.MarkDirty(true)
|
||||
return r.protoProxy.MarkDirty(true)
|
||||
}
|
||||
|
||||
func (r *Room) UpdateParticipantMetadata(participant types.LocalParticipant, name string, metadata string) {
|
||||
|
||||
@@ -776,7 +776,9 @@ func (r *RoomManager) UpdateRoomMetadata(ctx context.Context, req *livekit.Updat
|
||||
}
|
||||
|
||||
room.Logger.Debugw("updating room")
|
||||
room.SetMetadata(req.Metadata)
|
||||
done := room.SetMetadata(req.Metadata)
|
||||
// wait till the update is applied
|
||||
<-done
|
||||
return room.ToProto(), nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user