fix: can not open connection when "CLIENT" command killed #78
This commit is contained in:
parent
9aaf32e2bf
commit
30d6da85a1
|
@ -251,6 +251,8 @@ func (b *browserService) getRedisClient(connName string, db int) (item connectio
|
||||||
err = fmt.Errorf("create conenction error: %s", err.Error())
|
err = fmt.Errorf("create conenction error: %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_ = client.Do(b.ctx, "CLIENT", "SETNAME", url.QueryEscape(selConn.Name)).Err()
|
||||||
// add hook to each node in cluster mode
|
// add hook to each node in cluster mode
|
||||||
var cluster *redis.ClusterClient
|
var cluster *redis.ClusterClient
|
||||||
if cluster, ok = client.(*redis.ClusterClient); ok {
|
if cluster, ok = client.(*redis.ClusterClient); ok {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"github.com/redis/go-redis/v9"
|
"github.com/redis/go-redis/v9"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -120,7 +119,6 @@ func (c *connectionService) buildOption(config types.ConnectionConfig) (*redis.O
|
||||||
}
|
}
|
||||||
|
|
||||||
option := &redis.Options{
|
option := &redis.Options{
|
||||||
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,
|
||||||
|
@ -174,7 +172,6 @@ func (c *connectionService) createRedisClient(config types.ConnectionConfig) (re
|
||||||
//RouteByLatency: false,
|
//RouteByLatency: false,
|
||||||
//RouteRandomly: false,
|
//RouteRandomly: false,
|
||||||
//ClusterSlots: nil,
|
//ClusterSlots: nil,
|
||||||
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