should check cmd.Err when using multi
@@ -139,9 +139,6 @@ func (r *Rediaron) GetMulti(ctx context.Context, keys []string) (map[string]stri
fetch := func(pipe redis.Pipeliner) error {
for _, k := range keys {
_, err := pipe.Get(ctx, k).Result()
- if isRedisNoKeyError(err) {
- return perrors.WithMessage(err, fmt.Sprintf("Key not found: %s", k))
- }
if err != nil {
return err
}
@@ -165,6 +162,10 @@ func (r *Rediaron) GetMulti(ctx context.Context, keys []string) (map[string]stri
return nil, ErrBadCmdType
}
+ if isRedisNoKeyError(c.Err()) {
+ return nil, perrors.WithMessage(err, fmt.Sprintf("Key not found: %s", key))
+ }
+
data[key] = c.Val()
}
return data, err
