forked from mirror/redis
Retry timeout by default
This commit is contained in:
parent
f6fc23d2fa
commit
39b67358d7
11
command.go
11
command.go
|
@ -70,7 +70,6 @@ func cmdString(cmd Cmder, val interface{}) string {
|
|||
}
|
||||
}
|
||||
return s
|
||||
|
||||
}
|
||||
|
||||
func cmdFirstKeyPos(cmd Cmder, info *CommandInfo) int {
|
||||
|
@ -102,14 +101,12 @@ type baseCmd struct {
|
|||
var _ Cmder = (*Cmd)(nil)
|
||||
|
||||
func (cmd *baseCmd) Name() string {
|
||||
if len(cmd._args) > 0 {
|
||||
// Cmd name must be lower cased.
|
||||
s := internal.ToLower(cmd.stringArg(0))
|
||||
cmd._args[0] = s
|
||||
return s
|
||||
}
|
||||
if len(cmd._args) == 0 {
|
||||
return ""
|
||||
}
|
||||
// Cmd name must be lower cased.
|
||||
return internal.ToLower(cmd.stringArg(0))
|
||||
}
|
||||
|
||||
func (cmd *baseCmd) Args() []interface{} {
|
||||
return cmd._args
|
||||
|
|
3
redis.go
3
redis.go
|
@ -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 {
|
||||
err := cn.WithWriter(ctx, c.opt.WriteTimeout, func(wr *proto.Writer) error {
|
||||
return writeCmd(wr, cmd)
|
||||
})
|
||||
if err != nil {
|
||||
retryTimeout = true
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue