mirror of
https://github.com/redis/go-redis.git
synced 2025-06-15 12:41:41 +03:00
Fixes #1386; pipeline.Exec() sometimes returns spurious StatusCmd
This is caused by function `wrapMultiExec` sometimes clobbering the caller's cmd slice, corrupting future requests.
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package redis_test
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
@ -67,6 +69,21 @@ var _ = Describe("pipelining", func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(cmds).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("handles large pipelines", func() {
|
||||
for callCount := 1; callCount < 16; callCount++ {
|
||||
for i := 1; i <= callCount; i++ {
|
||||
pipe.SetNX(ctx, strconv.Itoa(i)+"_key", strconv.Itoa(i)+"_value", 0)
|
||||
}
|
||||
|
||||
cmds, err := pipe.Exec(ctx)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(cmds).To(HaveLen(callCount))
|
||||
for _, cmd := range cmds {
|
||||
Expect(cmd).To(BeAssignableToTypeOf(&redis.BoolCmd{}))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Describe("Pipeline", func() {
|
||||
|
Reference in New Issue
Block a user