Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a397797

Browse files
authoredOct 30, 2023
Merge branch 'master' into master
2 parents 5b2e7b7 + a5fe174 commit a397797

File tree

6 files changed

+58
-18
lines changed

6 files changed

+58
-18
lines changed
 

‎options.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ type Options struct {
142142
// Enables read only queries on slave/follower nodes.
143143
readOnly bool
144144

145-
// // Disable set-lib on connect. Default is false.
145+
// Disable set-lib on connect. Default is false.
146146
DisableIndentity bool
147147
}
148148

@@ -461,6 +461,7 @@ func setupConnParams(u *url.URL, o *Options) (*Options, error) {
461461
o.PoolTimeout = q.duration("pool_timeout")
462462
o.MinIdleConns = q.int("min_idle_conns")
463463
o.MaxIdleConns = q.int("max_idle_conns")
464+
o.MaxActiveConns = q.int("max_active_conns")
464465
if q.has("conn_max_idle_time") {
465466
o.ConnMaxIdleTime = q.duration("conn_max_idle_time")
466467
} else {

‎osscluster.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ type ClusterOptions struct {
8080
PoolTimeout time.Duration
8181
MinIdleConns int
8282
MaxIdleConns int
83+
MaxActiveConns int // applies per cluster node and not for the whole cluster
8384
ConnMaxIdleTime time.Duration
8485
ConnMaxLifetime time.Duration
8586

@@ -233,6 +234,8 @@ func setupClusterQueryParams(u *url.URL, o *ClusterOptions) (*ClusterOptions, er
233234
o.PoolFIFO = q.bool("pool_fifo")
234235
o.PoolSize = q.int("pool_size")
235236
o.MinIdleConns = q.int("min_idle_conns")
237+
o.MaxIdleConns = q.int("max_idle_conns")
238+
o.MaxActiveConns = q.int("max_active_conns")
236239
o.PoolTimeout = q.duration("pool_timeout")
237240
o.ConnMaxLifetime = q.duration("conn_max_lifetime")
238241
o.ConnMaxIdleTime = q.duration("conn_max_idle_time")
@@ -274,15 +277,17 @@ func (opt *ClusterOptions) clientOptions() *Options {
274277
MinRetryBackoff: opt.MinRetryBackoff,
275278
MaxRetryBackoff: opt.MaxRetryBackoff,
276279

277-
DialTimeout: opt.DialTimeout,
278-
ReadTimeout: opt.ReadTimeout,
279-
WriteTimeout: opt.WriteTimeout,
280+
DialTimeout: opt.DialTimeout,
281+
ReadTimeout: opt.ReadTimeout,
282+
WriteTimeout: opt.WriteTimeout,
283+
ContextTimeoutEnabled: opt.ContextTimeoutEnabled,
280284

281285
PoolFIFO: opt.PoolFIFO,
282286
PoolSize: opt.PoolSize,
283287
PoolTimeout: opt.PoolTimeout,
284288
MinIdleConns: opt.MinIdleConns,
285289
MaxIdleConns: opt.MaxIdleConns,
290+
MaxActiveConns: opt.MaxActiveConns,
286291
ConnMaxIdleTime: opt.ConnMaxIdleTime,
287292
ConnMaxLifetime: opt.ConnMaxLifetime,
288293
DisableIndentity: opt.DisableIndentity,

‎pubsub.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,11 +487,11 @@ func (c *PubSub) getContext() context.Context {
487487

488488
// Channel returns a Go channel for concurrently receiving messages.
489489
// The channel is closed together with the PubSub. If the Go channel
490-
// is blocked full for 30 seconds the message is dropped.
490+
// is blocked full for 1 minute the message is dropped.
491491
// Receive* APIs can not be used after channel is created.
492492
//
493493
// go-redis periodically sends ping messages to test connection health
494-
// and re-subscribes if ping can not not received for 30 seconds.
494+
// and re-subscribes if ping can not not received for 1 minute.
495495
func (c *PubSub) Channel(opts ...ChannelOption) <-chan *Message {
496496
c.chOnce.Do(func() {
497497
c.msgCh = newChannel(c, opts...)

‎ring.go

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,12 @@ type RingOptions struct {
7979
MinRetryBackoff time.Duration
8080
MaxRetryBackoff time.Duration
8181

82-
DialTimeout time.Duration
83-
ReadTimeout time.Duration
84-
WriteTimeout time.Duration
82+
DialTimeout time.Duration
83+
ReadTimeout time.Duration
84+
WriteTimeout time.Duration
85+
ContextTimeoutEnabled bool
86+
87+
ContextTimeoutEnabled bool
8588

8689
// PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO).
8790
PoolFIFO bool
@@ -90,11 +93,14 @@ type RingOptions struct {
9093
PoolTimeout time.Duration
9194
MinIdleConns int
9295
MaxIdleConns int
96+
MaxActiveConns int
9397
ConnMaxIdleTime time.Duration
9498
ConnMaxLifetime time.Duration
9599

96100
TLSConfig *tls.Config
97101
Limiter Limiter
102+
103+
DisableIndentity bool
98104
}
99105

100106
func (opt *RingOptions) init() {
@@ -144,20 +150,26 @@ func (opt *RingOptions) clientOptions() *Options {
144150

145151
MaxRetries: -1,
146152

147-
DialTimeout: opt.DialTimeout,
148-
ReadTimeout: opt.ReadTimeout,
149-
WriteTimeout: opt.WriteTimeout,
153+
DialTimeout: opt.DialTimeout,
154+
ReadTimeout: opt.ReadTimeout,
155+
WriteTimeout: opt.WriteTimeout,
156+
ContextTimeoutEnabled: opt.ContextTimeoutEnabled,
157+
158+
ContextTimeoutEnabled: opt.ContextTimeoutEnabled,
150159

151160
PoolFIFO: opt.PoolFIFO,
152161
PoolSize: opt.PoolSize,
153162
PoolTimeout: opt.PoolTimeout,
154163
MinIdleConns: opt.MinIdleConns,
155164
MaxIdleConns: opt.MaxIdleConns,
165+
MaxActiveConns: opt.MaxActiveConns,
156166
ConnMaxIdleTime: opt.ConnMaxIdleTime,
157167
ConnMaxLifetime: opt.ConnMaxLifetime,
158168

159169
TLSConfig: opt.TLSConfig,
160170
Limiter: opt.Limiter,
171+
172+
DisableIndentity: opt.DisableIndentity,
161173
}
162174
}
163175

‎sentinel.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,13 @@ type FailoverOptions struct {
7474
PoolTimeout time.Duration
7575
MinIdleConns int
7676
MaxIdleConns int
77+
MaxActiveConns int
7778
ConnMaxIdleTime time.Duration
7879
ConnMaxLifetime time.Duration
7980

8081
TLSConfig *tls.Config
82+
83+
DisableIndentity bool
8184
}
8285

8386
func (opt *FailoverOptions) clientOptions() *Options {
@@ -107,10 +110,13 @@ func (opt *FailoverOptions) clientOptions() *Options {
107110
PoolTimeout: opt.PoolTimeout,
108111
MinIdleConns: opt.MinIdleConns,
109112
MaxIdleConns: opt.MaxIdleConns,
113+
MaxActiveConns: opt.MaxActiveConns,
110114
ConnMaxIdleTime: opt.ConnMaxIdleTime,
111115
ConnMaxLifetime: opt.ConnMaxLifetime,
112116

113117
TLSConfig: opt.TLSConfig,
118+
119+
DisableIndentity: opt.DisableIndentity,
114120
}
115121
}
116122

@@ -130,15 +136,17 @@ func (opt *FailoverOptions) sentinelOptions(addr string) *Options {
130136
MinRetryBackoff: opt.MinRetryBackoff,
131137
MaxRetryBackoff: opt.MaxRetryBackoff,
132138

133-
DialTimeout: opt.DialTimeout,
134-
ReadTimeout: opt.ReadTimeout,
135-
WriteTimeout: opt.WriteTimeout,
139+
DialTimeout: opt.DialTimeout,
140+
ReadTimeout: opt.ReadTimeout,
141+
WriteTimeout: opt.WriteTimeout,
142+
ContextTimeoutEnabled: opt.ContextTimeoutEnabled,
136143

137144
PoolFIFO: opt.PoolFIFO,
138145
PoolSize: opt.PoolSize,
139146
PoolTimeout: opt.PoolTimeout,
140147
MinIdleConns: opt.MinIdleConns,
141148
MaxIdleConns: opt.MaxIdleConns,
149+
MaxActiveConns: opt.MaxActiveConns,
142150
ConnMaxIdleTime: opt.ConnMaxIdleTime,
143151
ConnMaxLifetime: opt.ConnMaxLifetime,
144152

@@ -165,15 +173,17 @@ func (opt *FailoverOptions) clusterOptions() *ClusterOptions {
165173
MinRetryBackoff: opt.MinRetryBackoff,
166174
MaxRetryBackoff: opt.MaxRetryBackoff,
167175

168-
DialTimeout: opt.DialTimeout,
169-
ReadTimeout: opt.ReadTimeout,
170-
WriteTimeout: opt.WriteTimeout,
176+
DialTimeout: opt.DialTimeout,
177+
ReadTimeout: opt.ReadTimeout,
178+
WriteTimeout: opt.WriteTimeout,
179+
ContextTimeoutEnabled: opt.ContextTimeoutEnabled,
171180

172181
PoolFIFO: opt.PoolFIFO,
173182
PoolSize: opt.PoolSize,
174183
PoolTimeout: opt.PoolTimeout,
175184
MinIdleConns: opt.MinIdleConns,
176185
MaxIdleConns: opt.MaxIdleConns,
186+
MaxActiveConns: opt.MaxActiveConns,
177187
ConnMaxIdleTime: opt.ConnMaxIdleTime,
178188
ConnMaxLifetime: opt.ConnMaxLifetime,
179189

‎universal.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type UniversalOptions struct {
4848
PoolTimeout time.Duration
4949
MinIdleConns int
5050
MaxIdleConns int
51+
MaxActiveConns int
5152
ConnMaxIdleTime time.Duration
5253
ConnMaxLifetime time.Duration
5354

@@ -64,6 +65,8 @@ type UniversalOptions struct {
6465
// Only failover clients.
6566

6667
MasterName string
68+
69+
DisableIndentity bool
6770
}
6871

6972
// Cluster returns cluster options created from the universal options.
@@ -102,10 +105,13 @@ func (o *UniversalOptions) Cluster() *ClusterOptions {
102105
PoolTimeout: o.PoolTimeout,
103106
MinIdleConns: o.MinIdleConns,
104107
MaxIdleConns: o.MaxIdleConns,
108+
MaxActiveConns: o.MaxActiveConns,
105109
ConnMaxIdleTime: o.ConnMaxIdleTime,
106110
ConnMaxLifetime: o.ConnMaxLifetime,
107111

108112
TLSConfig: o.TLSConfig,
113+
114+
DisableIndentity: o.DisableIndentity,
109115
}
110116
}
111117

@@ -144,10 +150,13 @@ func (o *UniversalOptions) Failover() *FailoverOptions {
144150
PoolTimeout: o.PoolTimeout,
145151
MinIdleConns: o.MinIdleConns,
146152
MaxIdleConns: o.MaxIdleConns,
153+
MaxActiveConns: o.MaxActiveConns,
147154
ConnMaxIdleTime: o.ConnMaxIdleTime,
148155
ConnMaxLifetime: o.ConnMaxLifetime,
149156

150157
TLSConfig: o.TLSConfig,
158+
159+
DisableIndentity: o.DisableIndentity,
151160
}
152161
}
153162

@@ -183,10 +192,13 @@ func (o *UniversalOptions) Simple() *Options {
183192
PoolTimeout: o.PoolTimeout,
184193
MinIdleConns: o.MinIdleConns,
185194
MaxIdleConns: o.MaxIdleConns,
195+
MaxActiveConns: o.MaxActiveConns,
186196
ConnMaxIdleTime: o.ConnMaxIdleTime,
187197
ConnMaxLifetime: o.ConnMaxLifetime,
188198

189199
TLSConfig: o.TLSConfig,
200+
201+
DisableIndentity: o.DisableIndentity,
190202
}
191203
}
192204

0 commit comments

Comments
 (0)
Please sign in to comment.