Start pgxpool background health check after initial connections

Otherwise the health check and the create initial connection(s) may both
create connections. While this generally wouldn't be a real problem it
did cause TestPoolBackgroundChecksMinConns to flicker on CI.
pull/1116/head
Jack Christensen 2021-11-20 11:19:10 -06:00
parent a55e88ee48
commit 058f346079
1 changed files with 2 additions and 2 deletions

View File

@ -222,8 +222,6 @@ func ConnectConfig(ctx context.Context, config *Config) (*Pool, error) {
config.MaxConns,
)
go p.backgroundHealthCheck()
if !config.LazyConnect {
if err := p.createIdleResources(ctx, int(p.minConns)); err != nil {
// Couldn't create resources for minpool size. Close unhealthy pool.
@ -240,6 +238,8 @@ func ConnectConfig(ctx context.Context, config *Config) (*Pool, error) {
res.Release()
}
go p.backgroundHealthCheck()
return p, nil
}