Update strored version of an active ingress if no ingress server responds (#1031)
This allows deleting and updating an ingress even if the ingress server that was handling it died. It does however mean that if the ingress responds again later, its state will be inconsistent. To somewhat make this less likely, also keep trying contacting the ingress for 1 min in the background. Also fixing a race where an active deleted Ingress would get recreated on delete because of the update triggered by the ingress session shutdown
This commit is contained in:
@@ -475,7 +475,11 @@ func parseEgressEnded(value string) (roomName string, endedAt int64, err error)
|
||||
return
|
||||
}
|
||||
|
||||
func (s *RedisStore) StoreIngress(_ context.Context, info *livekit.IngressInfo) error {
|
||||
func (s *RedisStore) StoreIngress(ctx context.Context, info *livekit.IngressInfo) error {
|
||||
return s.storeIngress(ctx, info, false)
|
||||
}
|
||||
|
||||
func (s *RedisStore) storeIngress(_ context.Context, info *livekit.IngressInfo, updateOnly bool) error {
|
||||
if info.IngressId == "" {
|
||||
return errors.New("Missing IngressId")
|
||||
}
|
||||
@@ -501,6 +505,9 @@ func (s *RedisStore) StoreIngress(_ context.Context, info *livekit.IngressInfo)
|
||||
switch err {
|
||||
case ErrIngressNotFound:
|
||||
// Ingress doesn't exist yet
|
||||
if updateOnly {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
oldRoom = oldInfo.RoomName
|
||||
oldStartedAt = oldInfo.State.StartedAt
|
||||
@@ -640,8 +647,8 @@ func (s *RedisStore) ListIngress(_ context.Context, roomName livekit.RoomName) (
|
||||
return infos, nil
|
||||
}
|
||||
|
||||
func (s *RedisStore) UpdateIngress(_ context.Context, info *livekit.IngressInfo) error {
|
||||
return s.StoreIngress(s.ctx, info)
|
||||
func (s *RedisStore) UpdateIngress(ctx context.Context, info *livekit.IngressInfo) error {
|
||||
return s.storeIngress(ctx, info, true)
|
||||
}
|
||||
|
||||
func (s *RedisStore) DeleteIngress(_ context.Context, info *livekit.IngressInfo) error {
|
||||
|
||||
Reference in New Issue
Block a user