Merge pull request #2119 from szyhf/szyhf-patch-1

fix: #2114 for redis-server not support Hello
This commit is contained in:
Vladimir Mihailenco 2022-06-12 10:48:59 +03:00 committed by GitHub
commit 25db55cdc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"strings"
"sync/atomic" "sync/atomic"
"time" "time"
@ -232,7 +233,7 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
// we continue to provide services with RESP2. // we continue to provide services with RESP2.
if err := conn.Hello(ctx, 3, username, password, "").Err(); err == nil { if err := conn.Hello(ctx, 3, username, password, "").Err(); err == nil {
auth = true auth = true
} else if err.Error() != "ERR unknown command 'hello'" { } else if !strings.HasPrefix(err.Error(), "ERR unknown command") {
return err return err
} }