Merge pull request #1121 from go-redis/fix/retyr-process

Retry timeout by default
This commit is contained in:
Vladimir Mihailenco 2019-08-12 16:00:26 +03:00 committed by GitHub
commit d22f03ecbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions

View File

@ -70,7 +70,6 @@ func cmdString(cmd Cmder, val interface{}) string {
} }
} }
return s return s
} }
func cmdFirstKeyPos(cmd Cmder, info *CommandInfo) int { func cmdFirstKeyPos(cmd Cmder, info *CommandInfo) int {
@ -102,13 +101,11 @@ type baseCmd struct {
var _ Cmder = (*Cmd)(nil) var _ Cmder = (*Cmd)(nil)
func (cmd *baseCmd) Name() string { func (cmd *baseCmd) Name() string {
if len(cmd._args) > 0 { if len(cmd._args) == 0 {
// Cmd name must be lower cased.
s := internal.ToLower(cmd.stringArg(0))
cmd._args[0] = s
return s
}
return "" return ""
}
// Cmd name must be lower cased.
return internal.ToLower(cmd.stringArg(0))
} }
func (cmd *baseCmd) Args() []interface{} { func (cmd *baseCmd) Args() []interface{} {

View File

@ -268,13 +268,12 @@ func (c *baseClient) _process(ctx context.Context, cmd Cmder) error {
} }
} }
var retryTimeout bool retryTimeout := true
lastErr = c.withConn(ctx, func(ctx context.Context, cn *pool.Conn) error { lastErr = c.withConn(ctx, func(ctx context.Context, cn *pool.Conn) error {
err := cn.WithWriter(ctx, c.opt.WriteTimeout, func(wr *proto.Writer) error { err := cn.WithWriter(ctx, c.opt.WriteTimeout, func(wr *proto.Writer) error {
return writeCmd(wr, cmd) return writeCmd(wr, cmd)
}) })
if err != nil { if err != nil {
retryTimeout = true
return err return err
} }