Retry timeout by default

This commit is contained in:
Vladimir Mihailenco 2019-08-12 14:53:00 +03:00
parent f6fc23d2fa
commit 39b67358d7
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. return ""
s := internal.ToLower(cmd.stringArg(0))
cmd._args[0] = s
return s
} }
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
} }