reduce reliance of funk, fixed bug getting subscribed tracks

This commit is contained in:
David Zhao
2021-03-27 21:54:46 -07:00
parent cb963f1637
commit dfac44d59e
11 changed files with 66 additions and 93 deletions
+9 -5
View File
@@ -4,8 +4,6 @@ import (
"sync"
"time"
"github.com/thoas/go-funk"
livekit "github.com/livekit/livekit-server/proto"
)
@@ -58,7 +56,11 @@ func (p *LocalRoomStore) GetRoom(idOrName string) (*livekit.Room, error) {
func (p *LocalRoomStore) ListRooms() ([]*livekit.Room, error) {
p.lock.RLock()
defer p.lock.RUnlock()
return funk.Values(p.rooms).([]*livekit.Room), nil
rooms := make([]*livekit.Room, 0, len(p.rooms))
for _, r := range p.rooms {
rooms = append(rooms, r)
}
return rooms, nil
}
func (p *LocalRoomStore) DeleteRoom(idOrName string) error {
@@ -115,8 +117,10 @@ func (p *LocalRoomStore) ListParticipants(roomName string) ([]*livekit.Participa
return nil, nil
}
items := funk.Values(roomParticipants).([]*livekit.ParticipantInfo)
// TODO: should short this to something reasonable
items := make([]*livekit.ParticipantInfo, 0, len(roomParticipants))
for _, p := range roomParticipants {
items = append(items, p)
}
return items, nil
}