From cc3c620b72632a078c16aa7e16112da5431111dd Mon Sep 17 00:00:00 2001 From: maxime Date: Tue, 7 May 2024 10:10:45 +0100 Subject: [PATCH] Stop printing warnings when we get redis.Nil errors. --- ChangeLog | 4 ++++ VERSION | 2 +- elan/rpc/rpc.go | 16 ++++++++-------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48fc567b..61f83b23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Version 11.10.1 +-------------- + * Stop printing warnings when we get redis.Nil errors. + Version 11.10.0 -------------- * Move redis flags to a common package. diff --git a/VERSION b/VERSION index 933dbb1d..46577f54 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -11.10.0 +11.10.1 diff --git a/elan/rpc/rpc.go b/elan/rpc/rpc.go index d8080f15..af2aa575 100644 --- a/elan/rpc/rpc.go +++ b/elan/rpc/rpc.go @@ -326,9 +326,9 @@ func (s *server) FindMissingBlobs(ctx context.Context, req *pb.FindMissingBlobsR func (s *server) blobExists(ctx context.Context, prefix string, digest *pb.Digest, compressed, redis bool) bool { if redis && s.readRedis != nil && prefix == CASPrefix && digest.SizeBytes < s.redisMaxSize { exists, err := s.readRedis.Exists(ctx, digest.Hash).Result() - if err != nil { + if err != nil && err != redis.Nil { log.Warningf("Failed to check blob in Redis: %v", err) - } else if exists > 0 { + } else if err != redis.Nil && exists > 0 { return true } } @@ -531,13 +531,13 @@ func (s *server) readCompressed(ctx context.Context, prefix string, digest *pb.D // NOTE: we could use GETRANGE here, but given it's a bit more expensive on the redis // side and redisMaxSize is quite small, we get the whole blob blob, err := s.readRedis.Get(ctx, digest.Hash).Bytes() - if err != nil { + if err != nil && err != redis.Nil { log.Warningf("Failed to get blob in Redis: %v", err) - } else if blob != nil && limit == 0 { + } else if err != redis.Nil && blob != nil && limit == 0 { return ioutil.NopCloser(bytes.NewReader(nil)), false, nil - } else if blob != nil && limit > 0 { + } else if err != redis.Nil && blob != nil && limit > 0 { return io.NopCloser(bytes.NewReader(blob[offset : offset+limit])), false, nil - } else if blob != nil && limit < 0 { + } else if err != redis.Nil && blob != nil && limit < 0 { return io.NopCloser(bytes.NewReader(blob[offset:])), false, nil } } @@ -623,9 +623,9 @@ func (s *server) readAllBlobBatched(ctx context.Context, prefix string, digest * if s.readRedis != nil && prefix == CASPrefix && digest.SizeBytes < s.redisMaxSize { blob, err := s.readRedis.Get(ctx, digest.Hash).Bytes() - if err != nil { + if err != nil && err != redis.Nil { log.Warningf("Failed to get blob in Redis: %v", err) - } else if blob != nil { + } else if err != redis.Nil && blob != nil { return blob, false, nil } }