fix: "CLIENT SETNAME" causes error with invalid character #56
This commit is contained in:
parent
7b3f526cd4
commit
8868f37828
|
@ -8,8 +8,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/redis/go-redis/v9"
|
"github.com/redis/go-redis/v9"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
"log"
|
|
||||||
"net"
|
"net"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -150,7 +150,7 @@ func (c *connectionService) buildOption(config types.ConnectionConfig) (*redis.O
|
||||||
}
|
}
|
||||||
|
|
||||||
option := &redis.Options{
|
option := &redis.Options{
|
||||||
ClientName: config.Name,
|
ClientName: url.QueryEscape(config.Name),
|
||||||
Addr: fmt.Sprintf("%s:%d", config.Addr, config.Port),
|
Addr: fmt.Sprintf("%s:%d", config.Addr, config.Port),
|
||||||
Username: config.Username,
|
Username: config.Username,
|
||||||
Password: config.Password,
|
Password: config.Password,
|
||||||
|
@ -198,14 +198,13 @@ func (c *connectionService) createRedisClient(config types.ConnectionConfig) (re
|
||||||
// connect to cluster
|
// connect to cluster
|
||||||
var slots []redis.ClusterSlot
|
var slots []redis.ClusterSlot
|
||||||
if slots, err = rdb.ClusterSlots(c.ctx).Result(); err == nil {
|
if slots, err = rdb.ClusterSlots(c.ctx).Result(); err == nil {
|
||||||
log.Println(slots)
|
|
||||||
clusterOptions := &redis.ClusterOptions{
|
clusterOptions := &redis.ClusterOptions{
|
||||||
//NewClient: nil,
|
//NewClient: nil,
|
||||||
//MaxRedirects: 0,
|
//MaxRedirects: 0,
|
||||||
//RouteByLatency: false,
|
//RouteByLatency: false,
|
||||||
//RouteRandomly: false,
|
//RouteRandomly: false,
|
||||||
//ClusterSlots: nil,
|
//ClusterSlots: nil,
|
||||||
ClientName: option.ClientName,
|
ClientName: url.QueryEscape(option.ClientName),
|
||||||
Dialer: option.Dialer,
|
Dialer: option.Dialer,
|
||||||
OnConnect: option.OnConnect,
|
OnConnect: option.OnConnect,
|
||||||
Protocol: option.Protocol,
|
Protocol: option.Protocol,
|
||||||
|
|
Loading…
Reference in New Issue