diff --git a/go.mod b/go.mod index 5c72c786..55530ba1 100644 --- a/go.mod +++ b/go.mod @@ -8,13 +8,15 @@ require ( github.com/gin-gonic/gin v1.10.0 github.com/google/uuid v1.3.0 github.com/splitio/gincache v1.0.1 - github.com/splitio/go-split-commons/v6 v6.0.2-0.20241122192419-cc8d0413fa8e + github.com/splitio/go-split-commons/v6 v6.0.2-0.20241125153044-959311072c68 github.com/splitio/go-toolkit/v5 v5.4.0 github.com/stretchr/testify v1.9.0 go.etcd.io/bbolt v1.3.6 golang.org/x/exp v0.0.0-20231006140011-7918f672742d ) +replace github.com/splitio/go-split-commons/v6 => /Users/maurosanz/go/src/github/splitio/go-split-commons + require ( github.com/bits-and-blooms/bitset v1.3.1 // indirect github.com/bits-and-blooms/bloom/v3 v3.3.1 // indirect diff --git a/go.sum b/go.sum index b4885fc2..c6504405 100644 --- a/go.sum +++ b/go.sum @@ -93,8 +93,6 @@ github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUA github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/splitio/gincache v1.0.1 h1:dLYdANY/BqH4KcUMCe/LluLyV5WtuE/LEdQWRE06IXU= github.com/splitio/gincache v1.0.1/go.mod h1:CcgJDSM9Af75kyBH0724v55URVwMBuSj5x1eCWIOECY= -github.com/splitio/go-split-commons/v6 v6.0.2-0.20241122192419-cc8d0413fa8e h1:0PMjUqkHtruM6arvxNbC3Yu6goqdkL/FuYeoWNmQ3K4= -github.com/splitio/go-split-commons/v6 v6.0.2-0.20241122192419-cc8d0413fa8e/go.mod h1:D/XIY/9Hmfk9ivWsRsJVp439kEdmHbzUi3PKzQQDOXY= github.com/splitio/go-toolkit/v5 v5.4.0 h1:g5WFpRhQomnXCmvfsNOWV4s5AuUrWIZ+amM68G8NBKM= github.com/splitio/go-toolkit/v5 v5.4.0/go.mod h1:xYhUvV1gga9/1029Wbp5pjnR6Cy8nvBpjw99wAbsMko= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/splitio/proxy/caching/mocks/mock.go b/splitio/proxy/caching/mocks/mock.go index 27a1224b..d3ef093d 100644 --- a/splitio/proxy/caching/mocks/mock.go +++ b/splitio/proxy/caching/mocks/mock.go @@ -152,6 +152,9 @@ func (s *LargeSegmentStorageMock) IsInLargeSegment(name string, key string) (boo args := s.Called(name, key) return args.Get(0).(bool), args.Error(1) } +func (s *LargeSegmentStorageMock) TotalKeys(name string) int { + return s.Called(name).Get(0).(int) +} // --- diff --git a/splitio/proxy/caching/workers.go b/splitio/proxy/caching/workers.go index a3d1edfa..682dc466 100644 --- a/splitio/proxy/caching/workers.go +++ b/splitio/proxy/caching/workers.go @@ -206,7 +206,7 @@ func (c *CacheAwareLargeSegmentSynchronizer) SynchronizeLargeSegments() (map[str } func (c *CacheAwareLargeSegmentSynchronizer) shouldEvictBySurrogate(name string, previousCN int64, currentCN int64) { - if currentCN > previousCN || currentCN == -1 { + if currentCN > previousCN || (previousCN != -1 && currentCN == -1) { c.cacheFlusher.EvictBySurrogate(MakeSurrogateForLargeSegmentChanges(name)) } }