Skip to content

Commit 058f346

Browse files
committed
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.
1 parent a55e88e commit 058f346

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pgxpool/pool.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,6 @@ func ConnectConfig(ctx context.Context, config *Config) (*Pool, error) {
222222
config.MaxConns,
223223
)
224224

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

241+
go p.backgroundHealthCheck()
242+
243243
return p, nil
244244
}
245245

0 commit comments

Comments
 (0)