[PR #149] Add DB_MAX conf #165

Open
opened 2026-02-26 21:34:48 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/eduardolat/pgbackweb/pull/149
Author: @minikill
Created: 10/29/2025
Status: 🔄 Open

Base: developHead: feature/add_connection_limit_config


📝 Commits (1)

📊 Changes

3 files changed (+17 additions, -2 deletions)

View changed files

📝 .env.example (+7 -0)
📝 internal/config/env.go (+2 -0)
📝 internal/database/connect.go (+8 -2)

📄 Description

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

https://github.com/eduardolat/pgbackweb/issues/148


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/eduardolat/pgbackweb/pull/149 **Author:** [@minikill](https://github.com/minikill) **Created:** 10/29/2025 **Status:** 🔄 Open **Base:** `develop` ← **Head:** `feature/add_connection_limit_config` --- ### 📝 Commits (1) - [`4e92885`](https://github.com/eduardolat/pgbackweb/commit/4e92885e879c046a966de46e22c57b5234d94d84) Add DB_MAX conf ### 📊 Changes **3 files changed** (+17 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+7 -0) 📝 `internal/config/env.go` (+2 -0) 📝 `internal/database/connect.go` (+8 -2) </details> ### 📄 Description ## 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 https://github.com/eduardolat/pgbackweb/issues/148 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pgbackweb#165
No description provided.