diff --git a/pgxpool/pool.go b/pgxpool/pool.go index c038bd0f..0fa7c98f 100644 --- a/pgxpool/pool.go +++ b/pgxpool/pool.go @@ -171,11 +171,9 @@ func ConnectConfig(ctx context.Context, config *Config) (*Pool, error) { return cr, nil }, func(value interface{}) { - go func() { - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) - value.(*connResource).conn.Close(ctx) - cancel() - }() + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + value.(*connResource).conn.Close(ctx) + cancel() }, config.MaxConns, )