@@ -68,6 +68,9 @@ type ClusterOptions struct {
6868 ReadTimeout time.Duration
6969 WriteTimeout time.Duration
7070
71+ // NewClient creates a cluster node client with provided name and options.
72+ NewClient func (opt * Options ) * Client
73+
7174 // PoolSize applies per cluster node and not for the whole cluster.
7275 PoolSize int
7376 MinIdleConns int
@@ -77,7 +80,6 @@ type ClusterOptions struct {
7780 IdleCheckFrequency time.Duration
7881
7982 TLSConfig * tls.Config
80- Limiter Limiter
8183}
8284
8385func (opt * ClusterOptions ) init () {
@@ -120,6 +122,10 @@ func (opt *ClusterOptions) init() {
120122 case 0 :
121123 opt .MaxRetryBackoff = 512 * time .Millisecond
122124 }
125+
126+ if opt .NewClient == nil {
127+ opt .NewClient = NewClient
128+ }
123129}
124130
125131func (opt * ClusterOptions ) clientOptions () * Options {
@@ -148,7 +154,6 @@ func (opt *ClusterOptions) clientOptions() *Options {
148154 IdleCheckFrequency : disableIdleCheck ,
149155
150156 TLSConfig : opt .TLSConfig ,
151- Limiter : opt .Limiter ,
152157 }
153158}
154159
@@ -166,7 +171,7 @@ func newClusterNode(clOpt *ClusterOptions, addr string) *clusterNode {
166171 opt := clOpt .clientOptions ()
167172 opt .Addr = addr
168173 node := clusterNode {
169- Client : NewClient (opt ),
174+ Client : clOpt . NewClient (opt ),
170175 }
171176
172177 node .latency = math .MaxUint32
0 commit comments