@@ -100,9 +100,12 @@ type Options struct {
100
100
PoolFIFO bool
101
101
// Base number of socket connections.
102
102
// Default is 10 connections per every available CPU as reported by runtime.GOMAXPROCS.
103
- // If there is not enough connections in the pool, new connections will be allocated in excess of PoolSize,
104
- // you can limit it through MaxActiveConns
103
+ // If there are not enough connections in the pool, new connections will be allocated beyond the PoolSize,
104
+ // which can flood the server with connections under heavy load.
105
+ // To enable standard pool behavior with overflow checking, use the PoolSizeStrict parameter
105
106
PoolSize int
107
+ // Enabling classic pool mode, when it is guaranteed that no more connections will open to the server than specified in PoolSize
108
+ PoolSizeStrict bool
106
109
// Amount of time client waits for connection if all connections
107
110
// are busy before returning an error.
108
111
// Default is ReadTimeout + 1 second.
@@ -114,9 +117,6 @@ type Options struct {
114
117
// Maximum number of idle connections.
115
118
// Default is 0. the idle connections are not closed by default.
116
119
MaxIdleConns int
117
- // Maximum number of connections allocated by the pool at a given time.
118
- // When zero, there is no limit on the number of connections in the pool.
119
- MaxActiveConns int
120
120
// ConnMaxIdleTime is the maximum amount of time a connection may be idle.
121
121
// Should be less than server's timeout.
122
122
//
@@ -458,10 +458,10 @@ func setupConnParams(u *url.URL, o *Options) (*Options, error) {
458
458
o .WriteTimeout = q .duration ("write_timeout" )
459
459
o .PoolFIFO = q .bool ("pool_fifo" )
460
460
o .PoolSize = q .int ("pool_size" )
461
+ o .PoolSizeStrict = q .bool ("pool_size_strict" )
461
462
o .PoolTimeout = q .duration ("pool_timeout" )
462
463
o .MinIdleConns = q .int ("min_idle_conns" )
463
464
o .MaxIdleConns = q .int ("max_idle_conns" )
464
- o .MaxActiveConns = q .int ("max_active_conns" )
465
465
if q .has ("conn_max_idle_time" ) {
466
466
o .ConnMaxIdleTime = q .duration ("conn_max_idle_time" )
467
467
} else {
@@ -505,10 +505,10 @@ func newConnPool(
505
505
},
506
506
PoolFIFO : opt .PoolFIFO ,
507
507
PoolSize : opt .PoolSize ,
508
+ PoolSizeStrict : opt .PoolSizeStrict ,
508
509
PoolTimeout : opt .PoolTimeout ,
509
510
MinIdleConns : opt .MinIdleConns ,
510
511
MaxIdleConns : opt .MaxIdleConns ,
511
- MaxActiveConns : opt .MaxActiveConns ,
512
512
ConnMaxIdleTime : opt .ConnMaxIdleTime ,
513
513
ConnMaxLifetime : opt .ConnMaxLifetime ,
514
514
})
0 commit comments