Skip to content

feat(db): make database pool size configurable - #408

Closed
kaicen-x wants to merge 1 commit into
Dvorinka:masterfrom
kaicen-x:master
Closed

kaicen-x wants to merge 1 commit into
Dvorinka:masterfrom
kaicen-x:master

Conversation

@kaicen-x

Copy link
Copy Markdown

The non-SQLite pool was hard-coded at 100 connections, so operators of
busy instances could not raise it without patching the source, and
small instances had no way to lower it.

  • pkg/conf: add Database.MaxOpenConns, settable via
    CR_CONF_Database.MaxOpenConns or config.yaml
  • inventory: size the pool from that value for non-SQLite databases
    and fall back to 100 when it is unset or out of the sane range
    (<= 10 or > 5000); SQLite keeps its 10-connection cap
  • docker-compose: ship 200 as the stack default and 50 for dev
  • drop trailing whitespace on the postgres image line

@Dvorinka

Copy link
Copy Markdown
Owner

Superseded by #409.

The pool is now configurable via Database.MaxOpenConns / CR_CONF_Database.MaxOpenConns. Unset or 0 keeps the old default of 100, values from 1 through 5000 are honored, and anything higher is clamped with a warning. SQLite stays on its own 10-connection cap.

This patch rejected every value <= 10, so a small instance still could not choose a pool under 11, and an out-of-range value silently fell back to 100 with no log. #409 covers the same docker-compose defaults (200 for the stack, 50 for dev) and adds a unit test for the sizing rules.

@Dvorinka Dvorinka closed this Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants