add active filter to ListEgress (#1517)

* add active filter to ListEgress

* update test

* missed a filter
This commit is contained in:
David Colburn
2023-03-14 13:07:00 -07:00
committed by GitHub
parent c2335968de
commit b23a0e7f39
7 changed files with 33 additions and 20 deletions
+11 -3
View File
@@ -350,7 +350,7 @@ func (s *RedisStore) LoadEgress(_ context.Context, egressID string) (*livekit.Eg
}
}
func (s *RedisStore) ListEgress(_ context.Context, roomName livekit.RoomName) ([]*livekit.EgressInfo, error) {
func (s *RedisStore) ListEgress(_ context.Context, roomName livekit.RoomName, active bool) ([]*livekit.EgressInfo, error) {
var infos []*livekit.EgressInfo
if roomName == "" {
@@ -368,7 +368,11 @@ func (s *RedisStore) ListEgress(_ context.Context, roomName livekit.RoomName) ([
if err != nil {
return nil, err
}
infos = append(infos, info)
// if active, filter status starting, active, and ending
if !active || int32(info.Status) < int32(livekit.EgressStatus_EGRESS_COMPLETE) {
infos = append(infos, info)
}
}
} else {
egressIDs, err := s.rc.SMembers(s.ctx, RoomEgressPrefix+string(roomName)).Result()
@@ -389,7 +393,11 @@ func (s *RedisStore) ListEgress(_ context.Context, roomName livekit.RoomName) ([
if err != nil {
return nil, err
}
infos = append(infos, info)
// if active, filter status starting, active, and ending
if !active || int32(info.Status) < int32(livekit.EgressStatus_EGRESS_COMPLETE) {
infos = append(infos, info)
}
}
}