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.
This commit is contained in:
+2
-2
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user