Skip to content

Commit

Permalink
Merge pull request #1747 from authzed/fix-min-conn-pgx
Browse files Browse the repository at this point in the history
fixes pgx min connection count always being set to max count
  • Loading branch information
vroldanbet authored Feb 19, 2024
2 parents a32213b + 8c13839 commit 58fef87
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/datastore/postgres/common/pgx.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,10 @@ func (opts PoolOptions) ConfigurePgx(pgxConfig *pgxpool.Config) {
pgxConfig.MaxConns = int32(*opts.MaxOpenConns)
}

// Default to keeping the pool maxed out at all times.
pgxConfig.MinConns = pgxConfig.MaxConns
if opts.MinOpenConns != nil {
// Default to keeping the pool maxed out at all times.
pgxConfig.MinConns = pgxConfig.MaxConns
pgxConfig.MinConns = int32(*opts.MinOpenConns)
}

if pgxConfig.MaxConns > 0 && pgxConfig.MinConns > 0 && pgxConfig.MaxConns < pgxConfig.MinConns {
Expand Down

0 comments on commit 58fef87

Please sign in to comment.