fix: move 'info replication' command within replica check (#936)

proxy does not support the info command
This commit is contained in:
u6th9d 2025-03-14 17:31:29 +08:00 committed by GitHub
parent 7655e754b1
commit 4a24a47ff4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -78,9 +78,9 @@ func NewRedisClient(ctx context.Context, address string, username string, passwo
if reply != "PONG" {
panic("ping failed with reply: " + reply)
}
reply = r.DoWithStringReply("info", "replication")
// get best replica
if replica {
reply = r.DoWithStringReply("info", "replication")
replicaInfo := getReplicaAddr(reply, address)
log.Infof("best replica: %s", replicaInfo.BestReplica)
r = NewRedisClient(ctx, replicaInfo.BestReplica, username, password, Tls, tlsConfig, false)