zitadel/internal/database
Zach H e009ed9fe4
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
2024-07-22 05:29:20 +00:00
..
cockroach fix: always use pgxpool config if MaxOpenConns isn't set (#8328) 2024-07-22 05:29:20 +00:00
dialect fix(db): add additional connection pool for projection spooling (#7094) 2023-12-20 16:13:04 +00:00
migrate feat(cli): init cli (#3186) 2022-02-09 15:01:19 +01:00
mock chore: use pgx v5 (#7577) 2024-03-27 15:48:22 +02:00
postgres fix: always use pgxpool config if MaxOpenConns isn't set (#8328) 2024-07-22 05:29:20 +00:00
database_test.go refactor: rename package errors to zerrors (#7039) 2023-12-08 15:30:55 +01:00
database.go refactor(database): exchange connection pool (#8325) 2024-07-17 15:16:02 +00:00
type_test.go chore: use pgx v5 (#7577) 2024-03-27 15:48:22 +02:00
type.go chore: use pgx v5 (#7577) 2024-03-27 15:48:22 +02:00