File tree 3 files changed +23
-5
lines changed
3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 1
1
* .rdb
2
2
testdata /* /
3
+ .idea /
Original file line number Diff line number Diff line change 1
1
package redis_test
2
2
3
3
import (
4
+ "strconv"
5
+
4
6
"github.com/go-redis/redis/v7"
5
7
6
8
. "github.com/onsi/ginkgo"
@@ -67,6 +69,21 @@ var _ = Describe("pipelining", func() {
67
69
Expect (err ).NotTo (HaveOccurred ())
68
70
Expect (cmds ).To (HaveLen (1 ))
69
71
})
72
+
73
+ It ("handles large pipelines" , func () {
74
+ for callCount := 1 ; callCount < 16 ; callCount ++ {
75
+ for i := 1 ; i <= callCount ; i ++ {
76
+ pipe .SetNX (strconv .Itoa (i )+ "_key" , strconv .Itoa (i )+ "_value" , 0 )
77
+ }
78
+
79
+ cmds , err := pipe .Exec ()
80
+ Expect (err ).NotTo (HaveOccurred ())
81
+ Expect (cmds ).To (HaveLen (callCount ))
82
+ for _ , cmd := range cmds {
83
+ Expect (cmd ).To (BeAssignableToTypeOf (& redis.BoolCmd {}))
84
+ }
85
+ }
86
+ })
70
87
}
71
88
72
89
Describe ("Pipeline" , func () {
Original file line number Diff line number Diff line change @@ -473,11 +473,11 @@ func wrapMultiExec(cmds []Cmder) []Cmder {
473
473
if len (cmds ) == 0 {
474
474
panic ("not reached" )
475
475
}
476
- cmds = append ( cmds , make ([]Cmder , 2 ) ... )
477
- copy ( cmds [ 1 :], cmds [: len ( cmds ) - 2 ] )
478
- cmds [ 0 ] = NewStatusCmd ( "multi" )
479
- cmds [len (cmds )- 1 ] = NewSliceCmd ("exec" )
480
- return cmds
476
+ cmdCopy := make ([]Cmder , len ( cmds ) + 2 )
477
+ cmdCopy [ 0 ] = NewStatusCmd ( "multi" )
478
+ copy ( cmdCopy [ 1 :], cmds )
479
+ cmdCopy [len (cmdCopy )- 1 ] = NewSliceCmd ("exec" )
480
+ return cmdCopy
481
481
}
482
482
483
483
func txPipelineReadQueued (rd * proto.Reader , statusCmd * StatusCmd , cmds []Cmder ) error {
You can’t perform that action at this time.
0 commit comments