1
0
mirror of https://github.com/redis/go-redis.git synced 2025-08-07 12:42:55 +03:00

Mark node as loading in Cluster pipeline read

This commit is contained in:
Vladimir Mihailenco
2019-05-25 17:42:01 +03:00
parent 75795aa423
commit 6238b8d4b7
3 changed files with 8 additions and 4 deletions

View File

@@ -1265,7 +1265,7 @@ func (c *ClusterClient) mapCmdsByNode(cmds []Cmder, cmdsMap *cmdsMap) error {
return err
}
cmdsAreReadOnly := c.cmdsAreReadOnly(cmds)
cmdsAreReadOnly := c.opt.ReadOnly && c.cmdsAreReadOnly(cmds)
for _, cmd := range cmds {
var node *clusterNode
var err error
@@ -1309,10 +1309,9 @@ func (c *ClusterClient) pipelineProcessCmds(
return err
}
err = cn.WithReader(c.opt.ReadTimeout, func(rd *proto.Reader) error {
return cn.WithReader(c.opt.ReadTimeout, func(rd *proto.Reader) error {
return c.pipelineReadCmds(node, rd, cmds, failedCmds)
})
return err
}
func (c *ClusterClient) pipelineReadCmds(
@@ -1329,7 +1328,9 @@ func (c *ClusterClient) pipelineReadCmds(
continue
}
if internal.IsRedisError(err) {
if c.opt.ReadOnly && internal.IsLoadingError(err) {
node.MarkAsLoading()
} else if internal.IsRedisError(err) {
continue
}