Skip to content

Commit 1c2b596

Browse files
committed
Mark node as loading in Cluster pipeline read
1 parent 75795aa commit 1c2b596

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cluster.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ func (c *ClusterClient) mapCmdsByNode(cmds []Cmder, cmdsMap *cmdsMap) error {
12651265
return err
12661266
}
12671267

1268-
cmdsAreReadOnly := c.cmdsAreReadOnly(cmds)
1268+
cmdsAreReadOnly := c.opt.ReadOnly && c.cmdsAreReadOnly(cmds)
12691269
for _, cmd := range cmds {
12701270
var node *clusterNode
12711271
var err error
@@ -1312,6 +1312,10 @@ func (c *ClusterClient) pipelineProcessCmds(
13121312
err = cn.WithReader(c.opt.ReadTimeout, func(rd *proto.Reader) error {
13131313
return c.pipelineReadCmds(node, rd, cmds, failedCmds)
13141314
})
1315+
if err == nil {
1316+
return nil
1317+
}
1318+
13151319
return err
13161320
}
13171321

@@ -1329,7 +1333,9 @@ func (c *ClusterClient) pipelineReadCmds(
13291333
continue
13301334
}
13311335

1332-
if internal.IsRedisError(err) {
1336+
if c.opt.ReadOnly && internal.IsLoadingError(err) {
1337+
node.MarkAsLoading()
1338+
} else if internal.IsRedisError(err) {
13331339
continue
13341340
}
13351341

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ require (
44
github.com/onsi/ginkgo v1.8.0
55
github.com/onsi/gomega v1.5.0
66
)
7+
8+
go 1.13

0 commit comments

Comments
 (0)