mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-10 21:03:51 +00:00
fix: always use pgxpool config if MaxOpenConns isn't set (#8328)
# Which Problems Are Solved
- `pgxpool -> pgx` dependency throws "MaxSize must be >= 1" on init if
`postgres.MaxOpenConns` isn't set in the ZItadel config
# How the Problems Are Solved
Only override the `MaxConns` with the Zitadel configured `MaxOpenConns`
if greater than 0 (default value). The default `MaxConns` [is derived by
`pgxpool`](ea9610f672/pgxpool/pool.go (L309-L324)
)
itself in a sensible way, but somewhat undocumented: checks for explicit
config in connection url or config and falls back on max(num_cpus, 4).
# Additional Changes
Applied same check in cockroach config
# Additional Context
This is likely a regression from the changes in
https://github.com/zitadel/zitadel/pull/8325
(cherry picked from commit e009ed9fe41ad84324677c3db74c8aadf16e5740)
This commit is contained in:
parent
c2521ebe0c
commit
1b84c1dff7
@ -81,7 +81,11 @@ func (c *Config) Connect(useAdmin bool, pusherRatio, spoolerRatio float64, purpo
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if connConfig.MaxOpenConns != 0 {
|
||||||
config.MaxConns = int32(connConfig.MaxOpenConns)
|
config.MaxConns = int32(connConfig.MaxOpenConns)
|
||||||
|
}
|
||||||
|
|
||||||
config.MaxConnLifetime = c.MaxConnLifetime
|
config.MaxConnLifetime = c.MaxConnLifetime
|
||||||
config.MaxConnIdleTime = c.MaxConnIdleTime
|
config.MaxConnIdleTime = c.MaxConnIdleTime
|
||||||
|
|
||||||
|
@ -82,7 +82,11 @@ func (c *Config) Connect(useAdmin bool, pusherRatio, spoolerRatio float64, purpo
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if connConfig.MaxOpenConns != 0 {
|
||||||
config.MaxConns = int32(connConfig.MaxOpenConns)
|
config.MaxConns = int32(connConfig.MaxOpenConns)
|
||||||
|
}
|
||||||
|
|
||||||
config.MaxConnLifetime = c.MaxConnLifetime
|
config.MaxConnLifetime = c.MaxConnLifetime
|
||||||
config.MaxConnIdleTime = c.MaxConnIdleTime
|
config.MaxConnIdleTime = c.MaxConnIdleTime
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user