mirror of https://github.com/go-redis/redis.git
fix: #2114 for redis-server not support Hello
Using `strings.HasPrefix` instead of `equal`
This commit is contained in:
parent
4ddd7d1803
commit
b6d2a92529
3
redis.go
3
redis.go
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
|
@ -232,7 +233,7 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
|
|||
// we continue to provide services with RESP2.
|
||||
if err := conn.Hello(ctx, 3, username, password, "").Err(); err == nil {
|
||||
auth = true
|
||||
} else if err.Error() != "ERR unknown command 'hello'" {
|
||||
} else if !strings.HasPrefix(err.Error(), "ERR unknown command") {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue