Skip to content

Commit b106565

Browse files
authored
Fix: redis MSet check the length of keys and values is equal (#4522)
Signed-off-by: georgehao <[email protected]>
1 parent cd29c23 commit b106565

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/chunk/cache/redis_client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ func (c *RedisClient) MSet(ctx context.Context, keys []string, values [][]byte)
9494
defer cancel()
9595
}
9696

97+
if len(keys) != len(values) {
98+
return fmt.Errorf("MSet the length of keys and values not equal, len(keys)=%d, len(values)=%d", len(keys), len(values))
99+
}
100+
97101
pipe := c.rdb.TxPipeline()
98102
for i := range keys {
99103
pipe.Set(ctx, keys[i], values[i], c.expiration)

0 commit comments

Comments
 (0)