From aaeba74402f53070685e09f4552c9d024aeb26e6 Mon Sep 17 00:00:00 2001 From: Benjamin Pracht Date: Tue, 6 Sep 2022 16:05:17 -0700 Subject: [PATCH] Import ErrIngressOutOfDate from protocol (#987) --- go.mod | 2 +- go.sum | 2 ++ pkg/service/errors.go | 1 - pkg/service/redisstore.go | 3 ++- pkg/service/redisstore_test.go | 3 ++- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index a83f3e9fd..9909c3d06 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/gorilla/websocket v1.5.0 github.com/hashicorp/go-version v1.6.0 github.com/hashicorp/golang-lru v0.5.4 - github.com/livekit/protocol v1.0.2-0.20220831180559-284d6b27297a + github.com/livekit/protocol v1.0.2-0.20220906220530-df2069bbbec1 github.com/livekit/rtcscore-go v0.0.0-20220815072451-20ee10ae1995 github.com/mackerelio/go-osstat v0.2.3 github.com/magefile/mage v1.13.0 diff --git a/go.sum b/go.sum index 5abf42e48..9c2df52d5 100644 --- a/go.sum +++ b/go.sum @@ -242,6 +242,8 @@ github.com/lithammer/shortuuid/v3 v3.0.7 h1:trX0KTHy4Pbwo/6ia8fscyHoGA+mf1jWbPJV github.com/lithammer/shortuuid/v3 v3.0.7/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts= github.com/livekit/protocol v1.0.2-0.20220831180559-284d6b27297a h1:UY0lVZdEixOguIApMxWRqLEYj7tSJDJguvzhJaPtl/Y= github.com/livekit/protocol v1.0.2-0.20220831180559-284d6b27297a/go.mod h1:ykRtMmaq4blqGyLWWPtYkB/74JYsyK7N2DAXLGnfSa4= +github.com/livekit/protocol v1.0.2-0.20220906220530-df2069bbbec1 h1:jjykqJJ0uQ+2HBIkkC/wpdbuKyawNfy7LzGVGRXQTc4= +github.com/livekit/protocol v1.0.2-0.20220906220530-df2069bbbec1/go.mod h1:ykRtMmaq4blqGyLWWPtYkB/74JYsyK7N2DAXLGnfSa4= github.com/livekit/rtcscore-go v0.0.0-20220815072451-20ee10ae1995 h1:vOaY2qvfLihDyeZtnGGN1Law9wRrw8BMGCr1TygTvMw= github.com/livekit/rtcscore-go v0.0.0-20220815072451-20ee10ae1995/go.mod h1:116ych8UaEs9vfIE8n6iZCZ30iagUFTls0vRmC+Ix5U= github.com/mackerelio/go-osstat v0.2.3 h1:jAMXD5erlDE39kdX2CU7YwCGRcxIO33u/p8+Fhe5dJw= diff --git a/pkg/service/errors.go b/pkg/service/errors.go index e2249e7ab..44d802606 100644 --- a/pkg/service/errors.go +++ b/pkg/service/errors.go @@ -16,5 +16,4 @@ var ( ErrRoomUnlockFailed = errors.New("could not unlock room, lock token does not match") ErrTrackNotFound = errors.New("track is not found") ErrWebHookMissingAPIKey = errors.New("api_key is required to use webhooks") - ErrIngressOutOfDate = errors.New("trying to ovewrite an ingress with an older version") ) diff --git a/pkg/service/redisstore.go b/pkg/service/redisstore.go index 82109bb06..79b5a8896 100644 --- a/pkg/service/redisstore.go +++ b/pkg/service/redisstore.go @@ -13,6 +13,7 @@ import ( "google.golang.org/protobuf/proto" "github.com/livekit/livekit-server/version" + "github.com/livekit/protocol/ingress" "github.com/livekit/protocol/livekit" "github.com/livekit/protocol/logger" "github.com/livekit/protocol/utils" @@ -474,7 +475,7 @@ func (s *RedisStore) StoreIngress(_ context.Context, info *livekit.IngressInfo) results, err := tx.TxPipelined(s.ctx, func(p redis.Pipeliner) error { if info.State.StartedAt < oldStartedAt { // Do not overwrite the info and state of a more recent session - return ErrIngressOutOfDate + return ingress.ErrIngressOutOfDate } p.HSet(s.ctx, IngressKey, info.IngressId, data) diff --git a/pkg/service/redisstore_test.go b/pkg/service/redisstore_test.go index 38cbde8ba..72d3d831c 100644 --- a/pkg/service/redisstore_test.go +++ b/pkg/service/redisstore_test.go @@ -10,6 +10,7 @@ import ( "go.uber.org/atomic" "google.golang.org/protobuf/proto" + "github.com/livekit/protocol/ingress" "github.com/livekit/protocol/livekit" "github.com/livekit/protocol/utils" @@ -256,7 +257,7 @@ func TestIngressStore(t *testing.T) { info.RoomName = "room2" info.State.StartedAt = 1 err = rs.UpdateIngress(ctx, info) - require.Equal(t, service.ErrIngressOutOfDate, err) + require.Equal(t, ingress.ErrIngressOutOfDate, err) info.RoomName = "room2" info.State.StartedAt = 3