mirror of
https://github.com/jackc/pgx.git
synced 2025-05-31 11:42:24 +00:00
Ensure there is a timeout for background pool connections
This commit is contained in:
parent
f3e04b28cc
commit
7ce634d62b
@ -214,6 +214,10 @@ func ConnectConfig(ctx context.Context, config *Config) (*Pool, error) {
|
||||
// see https://github.com/jackc/pgx/issues/1259
|
||||
ctx = detachedCtx{ctx}
|
||||
|
||||
// But we do want to ensure that a connect won't hang forever.
|
||||
ctx, cancel := context.WithTimeout(ctx, 2*time.Minute)
|
||||
defer cancel()
|
||||
|
||||
connConfig := p.config.ConnConfig
|
||||
|
||||
if p.beforeConnect != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user