From e23cc7fc5411f0fa340db5c02d84cada5bef649e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20M=C3=A1rquez?= Date: Thu, 5 Oct 2023 15:36:14 -0500 Subject: [PATCH] fix(storage/redis): add check for empty values --- storage/redis.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/storage/redis.go b/storage/redis.go index 70accc0b9..e9280902d 100644 --- a/storage/redis.go +++ b/storage/redis.go @@ -271,13 +271,26 @@ func (r *RedisClusterStorageManager) GetAndDeleteSet(keyName string, chunkSize i log.WithFields(logrus.Fields{ "prefix": redisLogPrefix, }).Error("Multi command failed: ", err) + log.WithFields(logrus.Fields{ + "prefix": redisLogPrefix, + }).Error("Records lost: ", len(lrange.Val())) r.Connect() } vals := lrange.Val() result := make([]interface{}, len(vals)) - for i, v := range vals { +unpacking: + for i := 0; i < len(result); i++ { + v := "" + for v == "" { + if len(vals) == 0 { + result = result[:i] + break unpacking + } + v = vals[0] + vals = vals[1:] + } result[i] = v }