Skip to content

Commit

Permalink
add setinfo option to cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
ofekshenawa committed Sep 19, 2023
1 parent cde9014 commit 776641e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 2 additions & 0 deletions bench_decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func NewClientStub(resp []byte) *ClientStub {
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
return stub.stubConn(initHello), nil
},
DisableClientSetInfo: true,
})
return stub
}
Expand All @@ -45,6 +46,7 @@ func NewClusterClientStub(resp []byte) *ClientStub {
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
return stub.stubConn(initHello), nil
},
DisableClientSetInfo: true,
ClusterSlots: func(_ context.Context) ([]ClusterSlot, error) {
return []ClusterSlot{
{
Expand Down
21 changes: 11 additions & 10 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ type ClusterOptions struct {
ConnMaxIdleTime time.Duration
ConnMaxLifetime time.Duration

TLSConfig *tls.Config
TLSConfig *tls.Config
DisableClientSetInfo bool // Disable set-lib on connect. Default is false.
}

func (opt *ClusterOptions) init() {
Expand Down Expand Up @@ -277,15 +278,15 @@ func (opt *ClusterOptions) clientOptions() *Options {
ReadTimeout: opt.ReadTimeout,
WriteTimeout: opt.WriteTimeout,

PoolFIFO: opt.PoolFIFO,
PoolSize: opt.PoolSize,
PoolTimeout: opt.PoolTimeout,
MinIdleConns: opt.MinIdleConns,
MaxIdleConns: opt.MaxIdleConns,
ConnMaxIdleTime: opt.ConnMaxIdleTime,
ConnMaxLifetime: opt.ConnMaxLifetime,

TLSConfig: opt.TLSConfig,
PoolFIFO: opt.PoolFIFO,
PoolSize: opt.PoolSize,
PoolTimeout: opt.PoolTimeout,
MinIdleConns: opt.MinIdleConns,
MaxIdleConns: opt.MaxIdleConns,
ConnMaxIdleTime: opt.ConnMaxIdleTime,
ConnMaxLifetime: opt.ConnMaxLifetime,
DisableClientSetInfo: opt.DisableClientSetInfo,
TLSConfig: opt.TLSConfig,
// If ClusterSlots is populated, then we probably have an artificial
// cluster whose nodes are not in clustering mode (otherwise there isn't
// much use for ClusterSlots config). This means we cannot execute the
Expand Down
2 changes: 1 addition & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ type Options struct {
// Enables read only queries on slave/follower nodes.
readOnly bool

// Disable set-lib during connect with name and version. Default is false.
// // Disable set-lib on connect. Default is false.
DisableClientSetInfo bool
}

Expand Down

0 comments on commit 776641e

Please sign in to comment.