Skip to content

fix(db): size background pool for burst traffic - #563

Merged
Soju06 merged 1 commit into
Soju06:mainfrom
Komzpa:fix/configurable-background-db-pool
May 9, 2026
Merged

Soju06 merged 1 commit into
Soju06:mainfrom
Komzpa:fix/configurable-background-db-pool

Conversation

@Komzpa

@Komzpa Komzpa commented May 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • adds explicit database_background_pool_size and database_background_max_overflow settings
  • defaults the background/request-adjacent DB pool to the main pool size and overflow instead of the hard-coded 3 + 2 capacity
  • keeps operators able to restore a smaller auxiliary pool explicitly
  • documents the background pool controls and adds OpenSpec coverage

Closes #521.

Verification

  • openspec validate configure-background-db-pool --strict
  • UV_PROJECT_ENVIRONMENT=/home/kom/.venvs/codex-lb-fix-521 uv run pytest tests/unit/test_db_session.py -q
  • UV_PROJECT_ENVIRONMENT=/home/kom/.venvs/codex-lb-fix-521 uv run ruff check app/db/session.py app/core/config/settings.py tests/unit/test_db_session.py
  • UV_PROJECT_ENVIRONMENT=/home/kom/.venvs/codex-lb-fix-521 uv run ty check app/db/session.py app/core/config/settings.py tests/unit/test_db_session.py
  • git diff --check

@Soju06

Soju06 commented May 9, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Soju06
Soju06 merged commit 1e397e8 into Soju06:main May 9, 2026
18 checks passed
@Soju06

Soju06 commented May 9, 2026

Copy link
Copy Markdown
Owner

@all-contributors please add @Komzpa for code, test

xirothedev added a commit to xirothedev/codex-lb that referenced this pull request May 10, 2026
…l fetch timeouts, image rewrite)

Upstream batch v1.16.0 highlights:
- proxy: expose drain status for graceful deploys (Soju06#564)
- proxy: narrow budget-safe gate to primary usage (Soju06#561)
- proxy: handle model fetch timeouts (Soju06#541)
- proxy: inline-rewrite input_image file references (Soju06#571)
- proxy: retry transient stream timeouts (Soju06#551)
- proxy: use DEFAULT_HOME_DIR for oversized response.create dumps (Soju06#575)
- accounts: split compact quota row + recover quota status (Soju06#562, Soju06#559)
- db: size background pool for burst traffic (Soju06#563)
- upstream: drop top_p for gpt-5 (Soju06#538)

Conflict resolved:
- app/modules/proxy/service.py: kept fork's multi-line import + FailurePhase
  (used by deterministic failover at line 8294).

Merge cleanup:
- app/main.py: removed pre-existing duplicate InFlightMiddleware class +
  duplicate _is_benign_metrics_bind_failure helper that shadowed canonical
  versions and broke new upstream test (test_in_flight_middleware_does_not_count_drain_status).

Verification:
- pytest tests/unit: 1459 passed, 17 failed (all pre-existing on backup
  branch backup/pre-upstream-merge-20260511 — date-bound API key tests,
  test_db_migrate.py SQLite env, settings duplicate validators).
- openspec validate --specs: 19/19 passed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
vitalNohj pushed a commit to vitalNohj/codex-lb that referenced this pull request Jul 17, 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.

[May be a bug] The codex-lb will straight hangs if there are burst requests

2 participants