Merge branch 'master' into v5-dev
This commit is contained in:
+1
-1
@@ -112,7 +112,7 @@ type Config struct {
|
||||
// MaxConnIdleTime is the duration after which an idle connection will be automatically closed by the health check.
|
||||
MaxConnIdleTime time.Duration
|
||||
|
||||
// MaxConns is the maximum size of the pool.
|
||||
// MaxConns is the maximum size of the pool. The default is the greater of 4 or runtime.NumCPU().
|
||||
MaxConns int32
|
||||
|
||||
// MinConns is the minimum size of the pool. The health check will increase the number of connections to this
|
||||
|
||||
@@ -415,7 +415,14 @@ func TestPoolBackgroundChecksMaxConnIdleTime(t *testing.T) {
|
||||
c, err := db.Acquire(context.Background())
|
||||
require.NoError(t, err)
|
||||
c.Release()
|
||||
time.Sleep(config.HealthCheckPeriod + 500*time.Millisecond)
|
||||
time.Sleep(config.HealthCheckPeriod)
|
||||
|
||||
for i := 0; i < 1000; i++ {
|
||||
if db.Stat().TotalConns() == 0 {
|
||||
break
|
||||
}
|
||||
time.Sleep(time.Millisecond)
|
||||
}
|
||||
|
||||
stats := db.Stat()
|
||||
assert.EqualValues(t, 0, stats.TotalConns())
|
||||
|
||||
Reference in New Issue
Block a user