mirror of
https://github.com/jackc/pgx.git
synced 2025-04-27 21:25:53 +00:00
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:
parent
a55e88ee48
commit
058f346079
@ -222,8 +222,6 @@ func ConnectConfig(ctx context.Context, config *Config) (*Pool, error) {
|
|||||||
config.MaxConns,
|
config.MaxConns,
|
||||||
)
|
)
|
||||||
|
|
||||||
go p.backgroundHealthCheck()
|
|
||||||
|
|
||||||
if !config.LazyConnect {
|
if !config.LazyConnect {
|
||||||
if err := p.createIdleResources(ctx, int(p.minConns)); err != nil {
|
if err := p.createIdleResources(ctx, int(p.minConns)); err != nil {
|
||||||
// Couldn't create resources for minpool size. Close unhealthy pool.
|
// 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()
|
res.Release()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
go p.backgroundHealthCheck()
|
||||||
|
|
||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user