Skip to content

Commit

Permalink
Stop after first timeout error
Browse files Browse the repository at this point in the history
Fixing IPV4 error for dualstack cluster without IPV6 connectivity jackc#139
  • Loading branch information
laskoviymishka committed Mar 13, 2024
1 parent 1860f4e commit c221406
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pgconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ func ConnectConfig(octx context.Context, config *Config) (pgConn *PgConn, err er
if _, ok := cerr.err.(*NotPreferredError); ok {
fallbackConfig = fc
}
if _, ok := cerr.err.(*errTimeout); ok {
// once we reach timeout it's useless to check other fallbacks
break
}
}
}

Expand Down

0 comments on commit c221406

Please sign in to comment.