@@ -68,6 +68,9 @@ type ClusterOptions struct {
68
68
ReadTimeout time.Duration
69
69
WriteTimeout time.Duration
70
70
71
+ // NewClient creates a cluster node client with provided name and options.
72
+ NewClient func (opt * Options ) * Client
73
+
71
74
// PoolSize applies per cluster node and not for the whole cluster.
72
75
PoolSize int
73
76
MinIdleConns int
@@ -77,7 +80,6 @@ type ClusterOptions struct {
77
80
IdleCheckFrequency time.Duration
78
81
79
82
TLSConfig * tls.Config
80
- Limiter Limiter
81
83
}
82
84
83
85
func (opt * ClusterOptions ) init () {
@@ -120,6 +122,10 @@ func (opt *ClusterOptions) init() {
120
122
case 0 :
121
123
opt .MaxRetryBackoff = 512 * time .Millisecond
122
124
}
125
+
126
+ if opt .NewClient == nil {
127
+ opt .NewClient = NewClient
128
+ }
123
129
}
124
130
125
131
func (opt * ClusterOptions ) clientOptions () * Options {
@@ -148,7 +154,6 @@ func (opt *ClusterOptions) clientOptions() *Options {
148
154
IdleCheckFrequency : disableIdleCheck ,
149
155
150
156
TLSConfig : opt .TLSConfig ,
151
- Limiter : opt .Limiter ,
152
157
}
153
158
}
154
159
@@ -166,7 +171,7 @@ func newClusterNode(clOpt *ClusterOptions, addr string) *clusterNode {
166
171
opt := clOpt .clientOptions ()
167
172
opt .Addr = addr
168
173
node := clusterNode {
169
- Client : NewClient (opt ),
174
+ Client : clOpt . NewClient (opt ),
170
175
}
171
176
172
177
node .latency = math .MaxUint32
0 commit comments