Skip to content

Commit 3846117

Browse files
jackcclaude
andcommitted
pgxpool: set pool_ping_timeout default explicitly
Give pool_ping_timeout a defaultPingTimeout and an else branch like pool_max_conns, pool_min_conns, pool_min_idle_conns, pool_max_conn_lifetime, pool_max_conn_idle_time and pool_health_check_period have. The default remains 0, meaning no timeout, so behavior is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 0253b9b commit 3846117

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

pgxpool/pool.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var (
2222
defaultMaxConnLifetime = time.Hour
2323
defaultMaxConnIdleTime = time.Minute * 30
2424
defaultHealthCheckPeriod = time.Minute
25+
defaultPingTimeout = time.Duration(0)
2526
)
2627

2728
type connResource struct {
@@ -457,6 +458,8 @@ func ParseConfig(connString string) (*Config, error) {
457458
return nil, pgconn.NewParseConfigError(connString, "cannot parse pool_ping_timeout", err)
458459
}
459460
config.PingTimeout = d
461+
} else {
462+
config.PingTimeout = defaultPingTimeout
460463
}
461464

462465
return config, nil

0 commit comments

Comments
 (0)