Skip to content

Commit ee6077f

Browse files
committed
should check cmd.Err when using multi
1 parent b40a3d8 commit ee6077f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

store/redis/rediaron.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@ func (r *Rediaron) GetMulti(ctx context.Context, keys []string) (map[string]stri
139139
fetch := func(pipe redis.Pipeliner) error {
140140
for _, k := range keys {
141141
_, err := pipe.Get(ctx, k).Result()
142-
if isRedisNoKeyError(err) {
143-
return perrors.WithMessage(err, fmt.Sprintf("Key not found: %s", k))
144-
}
145142
if err != nil {
146143
return err
147144
}
@@ -165,6 +162,10 @@ func (r *Rediaron) GetMulti(ctx context.Context, keys []string) (map[string]stri
165162
return nil, ErrBadCmdType
166163
}
167164

165+
if isRedisNoKeyError(c.Err()) {
166+
return nil, perrors.WithMessage(err, fmt.Sprintf("Key not found: %s", key))
167+
}
168+
168169
data[key] = c.Val()
169170
}
170171
return data, err

0 commit comments

Comments
 (0)