Skip to content

Conversation

@minikill
Copy link

Summary

Adds environment variables to configure database connection pool limits, providing better control over database resource usage.

Changes

  • Added PBW_DB_MAX_CONNS environment variable (default: 10)
  • Added PBW_DB_MAX_IDLE_CONNS environment variable (default: 5)
  • Updated connection pool configuration to use these values
  • Added documentation in .env.example
  • Logs connection pool settings on startup for visibility

Motivation

  • Allows users to limit database connections to prevent connection pool exhaustion
  • Useful for environments with connection limits (e.g., managed databases)
  • Workaround for lib/pq driver issues: The current PostgreSQL driver (lib/pq) has known prepared statement conflicts in connection pools, especially with managed databases like DigitalOcean. Setting up the exact number of connections allows to avoid using connection pools
  • Provides flexibility to tune performance vs. stability based on deployment environment

Testing

  • ✅ All existing tests pass
  • ✅ Linting passes
  • ✅ Tested locally with various connection pool configurations
  • ✅ Verified single connection mode eliminates prepared statement errors

Issue

#148

@coderabbitai
Copy link

coderabbitai bot commented Oct 29, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant