Skip to content

Commit 25db55c

Browse files
authored
Merge pull request #2119 from szyhf/szyhf-patch-1
fix: #2114 for redis-server not support Hello
2 parents 4ddd7d1 + b6d2a92 commit 25db55c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

redis.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"strings"
78
"sync/atomic"
89
"time"
910

@@ -228,11 +229,11 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
228229

229230
var auth bool
230231

231-
// For redis-server <6.0 that does not support the Hello command,
232+
// For redis-server < 6.0 that does not support the Hello command,
232233
// we continue to provide services with RESP2.
233234
if err := conn.Hello(ctx, 3, username, password, "").Err(); err == nil {
234235
auth = true
235-
} else if err.Error() != "ERR unknown command 'hello'" {
236+
} else if !strings.HasPrefix(err.Error(), "ERR unknown command") {
236237
return err
237238
}
238239

0 commit comments

Comments
 (0)