diff --git a/go.mod b/go.mod index 29fab091ab74..464580c82099 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/GoogleCloudPlatform/docker-credential-gcr v2.0.5+incompatible github.com/Masterminds/sprig/v3 v3.2.3 github.com/NYTimes/gziphandler v1.1.1 - github.com/alicebob/miniredis/v2 v2.31.0 + github.com/alicebob/miniredis/v2 v2.31.1 github.com/aquasecurity/bolt-fixtures v0.0.0-20200903104109-d34e7f983986 github.com/aquasecurity/defsec v0.94.1 github.com/aquasecurity/go-dep-parser v0.0.0-20240202105001-4f19ab402b0b diff --git a/go.sum b/go.sum index 5682d6d07c05..1c7a5f69f350 100644 --- a/go.sum +++ b/go.sum @@ -311,8 +311,8 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= -github.com/alicebob/miniredis/v2 v2.31.0 h1:ObEFUNlJwoIiyjxdrYF0QIDE7qXcLc7D3WpSH4c22PU= -github.com/alicebob/miniredis/v2 v2.31.0/go.mod h1:UB/T2Uztp7MlFSDakaX1sTXUv5CASoprx0wulRT6HBg= +github.com/alicebob/miniredis/v2 v2.31.1 h1:7XAt0uUg3DtwEKW5ZAGa+K7FZV2DdKQo5K/6TTnfX8Y= +github.com/alicebob/miniredis/v2 v2.31.1/go.mod h1:UB/T2Uztp7MlFSDakaX1sTXUv5CASoprx0wulRT6HBg= github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092 h1:aM1rlcoLz8y5B2r4tTLMiVTrMtpfY0O8EScKJxaSaEc= github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092/go.mod h1:rYqSE9HbjzpHTI74vwPvae4ZVYZd1lue2ta6xHPdblA= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= diff --git a/pkg/fanal/cache/redis.go b/pkg/fanal/cache/redis.go index 60096a1dc280..af9d2622b531 100644 --- a/pkg/fanal/cache/redis.go +++ b/pkg/fanal/cache/redis.go @@ -131,18 +131,15 @@ func (c RedisCache) Close() error { func (c RedisCache) Clear() error { ctx := context.Background() - var cursor uint64 for { - var keys []string - var err error - keys, cursor, err = c.client.Scan(ctx, cursor, redisPrefix+"::*", 100).Result() + keys, cursor, err := c.client.Scan(ctx, 0, redisPrefix+"::*", 100).Result() if err != nil { return xerrors.Errorf("failed to perform prefix scanning: %w", err) } if err = c.client.Unlink(ctx, keys...).Err(); err != nil { return xerrors.Errorf("failed to unlink redis keys: %w", err) } - if cursor == 0 { + if cursor == 0 { // We cleared all keys break } }