mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Make proto/parser an internal package
This commit is contained in:
10
redis.go
10
redis.go
@ -5,9 +5,13 @@ import (
|
||||
"log"
|
||||
|
||||
"gopkg.in/redis.v4/internal"
|
||||
"gopkg.in/redis.v4/internal/errors"
|
||||
"gopkg.in/redis.v4/internal/pool"
|
||||
)
|
||||
|
||||
// Redis nil reply, .e.g. when key does not exist.
|
||||
const Nil = errors.Nil
|
||||
|
||||
func SetLogger(logger *log.Logger) {
|
||||
internal.Logger = logger
|
||||
}
|
||||
@ -38,7 +42,7 @@ func (c *baseClient) conn() (*pool.Conn, error) {
|
||||
}
|
||||
|
||||
func (c *baseClient) putConn(cn *pool.Conn, err error, allowTimeout bool) bool {
|
||||
if isBadConn(err, allowTimeout) {
|
||||
if errors.IsBadConn(err, allowTimeout) {
|
||||
_ = c.connPool.Remove(cn, err)
|
||||
return false
|
||||
}
|
||||
@ -97,7 +101,7 @@ func (c *baseClient) Process(cmd Cmder) error {
|
||||
if err := writeCmd(cn, cmd); err != nil {
|
||||
c.putConn(cn, err, false)
|
||||
cmd.setErr(err)
|
||||
if err != nil && shouldRetry(err) {
|
||||
if err != nil && errors.IsRetryable(err) {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
@ -105,7 +109,7 @@ func (c *baseClient) Process(cmd Cmder) error {
|
||||
|
||||
err = cmd.readReply(cn)
|
||||
c.putConn(cn, err, readTimeout != nil)
|
||||
if err != nil && shouldRetry(err) {
|
||||
if err != nil && errors.IsRetryable(err) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user