File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -784,6 +784,8 @@ func (c *Ring) generalProcessPipeline(
784
784
}
785
785
786
786
var wg sync.WaitGroup
787
+ errs := make (chan error , len (cmdsMap ))
788
+
787
789
for hash , cmds := range cmdsMap {
788
790
wg .Add (1 )
789
791
go func (hash string , cmds []Cmder ) {
@@ -796,16 +798,23 @@ func (c *Ring) generalProcessPipeline(
796
798
return
797
799
}
798
800
801
+ hook := shard .Client .processPipelineHook
799
802
if tx {
800
- cmds = wrapMultiExec (ctx , cmds )
801
- _ = shard .Client .processTxPipelineHook (ctx , cmds )
802
- } else {
803
- _ = shard .Client .processPipelineHook (ctx , cmds )
803
+ cmds , hook = wrapMultiExec (ctx , cmds ), shard .Client .processTxPipelineHook
804
+ }
805
+
806
+ if err = hook (ctx , cmds ); err != nil {
807
+ errs <- err
804
808
}
805
809
}(hash , cmds )
806
810
}
807
811
808
812
wg .Wait ()
813
+ close (errs )
814
+
815
+ if err := <- errs ; err != nil {
816
+ return err
817
+ }
809
818
return cmdsFirstErr (cmds )
810
819
}
811
820
Original file line number Diff line number Diff line change @@ -271,6 +271,21 @@ var _ = Describe("Redis Ring", func() {
271
271
Expect (ringShard1 .Info (ctx ).Val ()).ToNot (ContainSubstring ("keys=" ))
272
272
Expect (ringShard2 .Info (ctx ).Val ()).To (ContainSubstring ("keys=100" ))
273
273
})
274
+
275
+ It ("return dial timeout error" , func () {
276
+ opt := redisRingOptions ()
277
+ opt .DialTimeout = 250 * time .Millisecond
278
+ opt .Addrs = map [string ]string {"ringShardNotExist" : ":1997" }
279
+ ring = redis .NewRing (opt )
280
+
281
+ _ , err := ring .Pipelined (ctx , func (pipe redis.Pipeliner ) error {
282
+ pipe .HSet (ctx , "key" , "value" )
283
+ pipe .Expire (ctx , "key" , time .Minute )
284
+ return nil
285
+ })
286
+
287
+ Expect (err ).To (HaveOccurred ())
288
+ })
274
289
})
275
290
276
291
Describe ("new client callback" , func () {
You can’t perform that action at this time.
0 commit comments