redis/go-redis

​​Multiple cmd.err are set to redis.Nil when one cmd returns redis.Nil​​

Closed this issue · 1 comments

Expected Behavior

var cmd1,cmd2 *StringCmd
_, err := client.Pipelined(ctx, func(pipeliner redis.Pipeliner) error {
		cmd1 = pipeliner.Get(ctx, key1) //key1 is not exist, and it will return redis.Nil
                 cmd2 = pipeliner.Get(ctx, key2) //key2 is exist.
 		return nil
	})
fmt.Println(cmd2.Err())  // Expected nil

Current Behavior

var cmd1,cmd2 *StringCmd
_, err := client.Pipelined(ctx, func(pipeliner redis.Pipeliner) error {
		cmd1 = pipeliner.Get(ctx, key1) //key1 is not exist, and it will return redis.Nil
                 cmd2 = pipeliner.Get(ctx, key2) //key2 is exist.
 		return nil
	})
fmt.Println(cmd2.Err())  // Current return redis.Nil

Context (Environment)

redis.go:633

Image

https://github.com/redis/go-redis/pull/3509/files

Hello, the issue has been resolved in this PR #3525 .